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" <tytso@mit.edu>
This commit is contained in:
Theodore Ts'o 2008-07-13 15:40:15 -04:00
parent ebabf2ad6d
commit 2a7bfe8353
4 changed files with 8 additions and 0 deletions

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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)) {

View File

@ -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)) {