(xfclose): Don't close stdout here (just flush it),
authorJim Meyering <jim@meyering.net>
Sat, 6 Nov 2004 22:37:02 +0000 (22:37 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 6 Nov 2004 22:37:02 +0000 (22:37 +0000)
since close_stdout now closes stdout unconditionally.

src/sort.c

index 511d0994d779bfe61cd9cf60ca949acc9bf39941..f607385b7b49e4244511d041d359ec363310b42c 100644 (file)
@@ -480,6 +480,12 @@ xfclose (FILE *fp, char const *file)
       if (feof (fp))
        clearerr (fp);
     }
+  else if (fp == stdout)
+    {
+      /* Don't close stdout just yet.  close_stdout does that.  */
+      if (fflush (fp) != 0)
+       die (_("fflush failed"), file);
+    }
   else
     {
       if (fclose (fp) != 0)