Browse Source

Do not attempt to close stderr after call to close_stdout.

Sergey Poznyakoff 18 years ago
parent
commit
372638ae7a
1 changed files with 5 additions and 4 deletions
  1. 5 4
      src/tar.c

+ 5 - 4
src/tar.c

@@ -2327,13 +2327,14 @@ main (int argc, char **argv)
   free (archive_name_array);
   name_term ();
 
-  if (stdlis == stdout)
-    close_stdout ();
-
   if (exit_status == TAREXIT_FAILURE)
     error (0, 0, _("Error exit delayed from previous errors"));
-  if (ferror (stderr) || fclose (stderr) != 0)
+
+  if (stdlis == stdout)
+    close_stdout ();
+  else if (ferror (stderr) || fclose (stderr) != 0) 
     exit_status = TAREXIT_FAILURE;
+
   return exit_status;
 }