From: Theodore Ts'o Date: Sun, 13 Jul 2008 19:40:15 +0000 (-0400) Subject: Flush stdio buffers before calling setbuf() X-Git-Tag: v1.41.1~132 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a7bfe835317bb9f3ebcd20079b2bb800f4b9eaa;p=thirdparty%2Fe2fsprogs.git Flush stdio buffers before calling setbuf() On Solaris setbuf() will discard any pending output to the stream, so make we call fflush() before calling setbuf(). Signed-off-by: "Theodore Ts'o" --- diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c index 85facacbc..7039340df 100644 --- a/debugfs/debugfs.c +++ b/debugfs/debugfs.c @@ -1822,6 +1822,8 @@ static int source_file(const char *cmd_file, int sci_idx) exit(1); } } + fflush(stdout); + fflush(stderr); setbuf(stdout, NULL); setbuf(stderr, NULL); while (!feof(f)) { diff --git a/lib/ss/test_ss.c b/lib/ss/test_ss.c index 0b0bb587b..36e899d31 100644 --- a/lib/ss/test_ss.c +++ b/lib/ss/test_ss.c @@ -49,6 +49,8 @@ static int source_file(const char *cmd_file, int sci_idx) exit(1); } } + fflush(stdout); + fflush(stderr); setbuf(stdout, NULL); setbuf(stderr, NULL); while (!feof(f)) { diff --git a/tests/progs/test_icount.c b/tests/progs/test_icount.c index 026779fbd..faffcf8a5 100644 --- a/tests/progs/test_icount.c +++ b/tests/progs/test_icount.c @@ -261,6 +261,8 @@ static int source_file(const char *cmd_file, int sci_idx) exit(1); } } + fflush(stdout); + fflush(stderr); setbuf(stdout, NULL); setbuf(stderr, NULL); while (!feof(f)) { diff --git a/tests/progs/test_rel.c b/tests/progs/test_rel.c index 351c662e0..86a9b0daf 100644 --- a/tests/progs/test_rel.c +++ b/tests/progs/test_rel.c @@ -677,6 +677,8 @@ static int source_file(const char *cmd_file, int sci_idx) exit(1); } } + fflush(stdout); + fflush(stderr); setbuf(stdout, NULL); setbuf(stderr, NULL); while (!feof(f)) {