Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--editors/sed.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/editors/sed.c b/editors/sed.c
index 00dde60be..6179c5e80 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -1648,6 +1648,11 @@ int sed_main(int argc UNUSED_PARAM, char **argv)
fchown(nonstdoutfd, statbuf.st_uid, statbuf.st_gid);
process_files();
+ fflush(G.nonstdout);
+ if (ferror(G.nonstdout)) {
+ xfunc_error_retval = 4; /* It's what gnu sed exits with... */
+ bb_simple_error_msg_and_die(bb_msg_write_error);
+ }
fclose(G.nonstdout);
G.nonstdout = stdout;