mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-19 03:33:43 +03:00
(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".
This commit is contained in:
1 parent
a3f05cf720
commit
93bf700a94
1 file changed
+8
-2
+8
-2
@@ -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 ();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user