[glib] testglib: test_file_functions: don't close fd if it's -1



commit a0f5e89aedd0fcd04164c35b1c77d194adfc698a
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Mon Dec 12 15:55:59 2011 +0000

    testglib: test_file_functions: don't close fd if it's -1
    
    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 |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/tests/testglib.c b/tests/testglib.c
index 1a06d10..2b7725e 100644
--- a/tests/testglib.c
+++ b/tests/testglib.c
@@ -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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]