gettimeofday: port recent C++ fix to Emacs
[gnulib.git] / tests / test-freopen.c
index cac907c..4b54d8d 100644 (file)
@@ -1,5 +1,5 @@
 /* Test of opening a file stream.
-   Copyright (C) 2007-2011 Free Software Foundation, Inc.
+   Copyright (C) 2007-2013 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
@@ -62,7 +62,9 @@ main ()
       }
   }
   {
-    FILE *fp = fdopen (99, "w+");
+    FILE *fp;
+    close (99);
+    fp = fdopen (99, "w+");
     if (fp != NULL)
       {
         errno = 0;