From: Denis Vlasenko Date: Tue, 26 Feb 2008 20:23:02 +0000 (-0000) Subject: lpr: fflush stdout fix X-Git-Tag: 1_10_0~91 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7be1030dcce0956d8bf12166c7a6fedbb1209169;p=oweals%2Fbusybox.git lpr: fflush stdout fix --- 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[]) cmd = (opts & LPQ_SHORT_FMT) ? 3 : 4; command: printf("%c" "%s\n", cmd, queue); + fflush(stdout); bb_copyfd_eof(STDOUT_FILENO, old_stdout); } @@ -225,6 +226,7 @@ int lpqr_main(int argc, char *argv[]) st.st_size = 0; /* paranoia: fstat may theoretically fail */ fstat(fd, &st); printf("\x3" "%"OFF_FMT"u d%s\n", st.st_size, remote_filename); + fflush(stdout); if (bb_copyfd_size(fd, STDOUT_FILENO, st.st_size) != st.st_size) { // We're screwed. We sent less bytes than we advertised. bb_error_msg_and_die("local file changed size?!");