aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-02-26 20:23:02 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-02-26 20:23:02 +0000
commit7be1030dcce0956d8bf12166c7a6fedbb1209169 (patch)
tree06f1611d61f6d225806cbabbb43d01792d87c471
parentbe048f21e62f18ddc5d1d135b8fe27f4e23d7bd2 (diff)
downloadbusybox-w32-7be1030dcce0956d8bf12166c7a6fedbb1209169.tar.gz
busybox-w32-7be1030dcce0956d8bf12166c7a6fedbb1209169.tar.bz2
busybox-w32-7be1030dcce0956d8bf12166c7a6fedbb1209169.zip
lpr: fflush stdout fix
-rw-r--r--printutils/lpr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/printutils/lpr.c b/printutils/lpr.c
index 09fbc6ad1..913da6f0f 100644
--- a/printutils/lpr.c
+++ b/printutils/lpr.c
@@ -130,6 +130,7 @@ int lpqr_main(int argc, char *argv[])
130 cmd = (opts & LPQ_SHORT_FMT) ? 3 : 4; 130 cmd = (opts & LPQ_SHORT_FMT) ? 3 : 4;
131 command: 131 command:
132 printf("%c" "%s\n", cmd, queue); 132 printf("%c" "%s\n", cmd, queue);
133 fflush(stdout);
133 bb_copyfd_eof(STDOUT_FILENO, old_stdout); 134 bb_copyfd_eof(STDOUT_FILENO, old_stdout);
134 } 135 }
135 136
@@ -225,6 +226,7 @@ int lpqr_main(int argc, char *argv[])
225 st.st_size = 0; /* paranoia: fstat may theoretically fail */ 226 st.st_size = 0; /* paranoia: fstat may theoretically fail */
226 fstat(fd, &st); 227 fstat(fd, &st);
227 printf("\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename); 228 printf("\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename);
229 fflush(stdout);
228 if (bb_copyfd_size(fd, STDOUT_FILENO, st.st_size) != st.st_size) { 230 if (bb_copyfd_size(fd, STDOUT_FILENO, st.st_size) != st.st_size) {
229 // We're screwed. We sent less bytes than we advertised. 231 // We're screwed. We sent less bytes than we advertised.
230 bb_error_msg_and_die("local file changed size?!"); 232 bb_error_msg_and_die("local file changed size?!");