diff options
author | Jim Meyering <jim@meyering.net> | 2003-09-23 21:57:13 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2003-09-23 21:57:13 +0000 |
commit | 93bf700a948f87b7c243b5ac1ffb06f30fb377be (patch) | |
tree | 6847170a7600f911af8f1595a212e96f62dd84a2 /src | |
parent | a3f05cf720073b01960be0ea389158937d81801d (diff) | |
download | coreutils-93bf700a948f87b7c243b5ac1ffb06f30fb377be.tar.xz |
(close_output_file): Don't report bogus errno value
after ferror discovers an output error. We don't know the proper
errno value, since it might have been caused by any of a whole
bunch of calls, and it might have been trashed in the meantime.
Fixing this problem will require much more extensive changes;
in the meantime just say "write error".
Diffstat (limited to 'src')
-rw-r--r-- | src/csplit.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/csplit.c b/src/csplit.c index 07fd2d321..5b15cac31 100644 --- a/src/csplit.c +++ b/src/csplit.c @@ -986,9 +986,15 @@ close_output_file (void) { if (output_stream) { - if (ferror (output_stream) || fclose (output_stream) == EOF) + if (ferror (output_stream)) { - error (0, errno, _("write error for `%s'"), output_filename); + error (0, 0, _("write error for `%s'"), output_filename); + output_stream = NULL; + cleanup_fatal (); + } + if (fclose (output_stream) != 0) + { + error (0, errno, "%s", output_filename); output_stream = NULL; cleanup_fatal (); } |