]> git.pld-linux.org Git - packages/busybox.git/blob - busybox-1.8.1-tr.patch
- from upstream
[packages/busybox.git] / busybox-1.8.1-tr.patch
1 diff -urN busybox-1.8.1/coreutils/tr.c busybox-1.8.1-tr/coreutils/tr.c
2 --- busybox-1.8.1/coreutils/tr.c        2007-11-09 18:40:51.000000000 -0700
3 +++ busybox-1.8.1-tr/coreutils/tr.c     2007-11-13 13:27:45.000000000 -0700
4 @@ -173,7 +173,8 @@
5         int idx = 1;
6         int i;
7         smalluint flags = 0;
8 -       size_t read_chars = 0, in_index = 0, out_index = 0, c, coded, last = -1;
9 +       ssize_t read_chars = 0;
10 +       size_t in_index = 0, out_index = 0, c, coded, last = -1;
11         RESERVE_CONFIG_UBUFFER(output, BUFSIZ);
12         RESERVE_CONFIG_BUFFER(vector, ASCII+1);
13         RESERVE_CONFIG_BUFFER(invec,  ASCII+1);
14 @@ -223,8 +224,9 @@
15                         }
16                         read_chars = read(STDIN_FILENO, tr_buf, BUFSIZ);
17                         if (read_chars <= 0) {
18 -                               if (write(STDOUT_FILENO, (char *)output, out_index) != out_index)
19 -                                       bb_perror_msg(bb_msg_write_error);
20 +                               xwrite(STDOUT_FILENO, (char *)output, out_index);
21 +                               if (read_chars < 0)
22 +                                       bb_perror_msg_and_die(bb_msg_read_error);
23                                 exit(EXIT_SUCCESS);
24                         }
25                         in_index = 0;
This page took 0.073291 seconds and 3 git commands to generate.