NEWS.stable: log cherry-pick [a0d9972]->[21d1619] freopen: Don't crash if the filenam...
[gnulib.git] / tests / test-fflush.c
index 12403e2..a6c0e18 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of POSIX compatible fflush() function.
-   Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc.
+   Copyright (C) 2007, 2009-2011 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -50,7 +50,8 @@ main (void)
   if (!f || 0 > fd || fread (buffer, 1, 5, f) != 5)
     {
       fputs ("Failed initial read of sample file.\n", stderr);
-      fclose (f);
+      if (f)
+        fclose (f);
       unlink ("test-fflush.txt");
       return 1;
     }