testglib: test_file_functions: don't close fd if it's -1
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 12 Dec 2011 15:55:59 +0000 (15:55 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Wed, 14 Dec 2011 12:40:02 +0000 (12:40 +0000)
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
tests/testglib.c

index 1a06d10..2b7725e 100644 (file)
@@ -952,7 +952,8 @@ test_file_functions (void)
       else
         g_print ("g_file_open_tmp correctly returns error: %s\n", error->message);
     }
-  close (fd);
+  if (fd != -1)
+    close (fd);
   g_clear_error (&error);
 
 #ifdef G_OS_WIN32