summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenis Vlasenko2007-11-24 04:37:59 +0000
committerDenis Vlasenko2007-11-24 04:37:59 +0000
commit80297d5f0cbe8a3de497804dcbb1a89e6f9c1562 (patch)
treef34fce2257aff722f25347bfce7e1375d7df5db6 /coreutils
parent3db254c8866de390c327d759ba615693e45aff6f (diff)
downloadbusybox-80297d5f0cbe8a3de497804dcbb1a89e6f9c1562.zip
busybox-80297d5f0cbe8a3de497804dcbb1a89e6f9c1562.tar.gz
Apply all post-1.8.1 patches1_8_2
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/tr.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 9521bbc..e60e08b 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -173,7 +173,8 @@ int tr_main(int argc, char **argv)
int idx = 1;
int i;
smalluint flags = 0;
- size_t read_chars = 0, in_index = 0, out_index = 0, c, coded, last = -1;
+ ssize_t read_chars = 0;
+ size_t in_index = 0, out_index = 0, c, coded, last = -1;
RESERVE_CONFIG_UBUFFER(output, BUFSIZ);
RESERVE_CONFIG_BUFFER(vector, ASCII+1);
RESERVE_CONFIG_BUFFER(invec, ASCII+1);
@@ -223,8 +224,9 @@ int tr_main(int argc, char **argv)
}
read_chars = read(STDIN_FILENO, tr_buf, BUFSIZ);
if (read_chars <= 0) {
- if (write(STDOUT_FILENO, (char *)output, out_index) != out_index)
- bb_perror_msg(bb_msg_write_error);
+ xwrite(STDOUT_FILENO, (char *)output, out_index);
+ if (read_chars < 0)
+ bb_perror_msg_and_die(bb_msg_read_error);
exit(EXIT_SUCCESS);
}
in_index = 0;