[glib/glib-2-40] gio/gtestdbus.c: Fix write_config_file() for Windows



commit 321b827d6b5d9b66e839b7aded5a7d5cb80102f0
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Tue Mar 18 12:54:10 2014 +0800

    gio/gtestdbus.c: Fix write_config_file() for Windows
    
    Windows does not like g_unlink() to be called on files whose file
    descriptor is still open, so doing that would cause a permission
    denied error.  Since the fd is not used in that function after
    acquiring the temp file, close it earlier before
    g_file_set_contents(), so that it can complete successfully.
    
    This fixes a number of GTK+ tests on Windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719344

 gio/gtestdbus.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
---
diff --git a/gio/gtestdbus.c b/gio/gtestdbus.c
index 17a9496..4b51d29 100644
--- a/gio/gtestdbus.c
+++ b/gio/gtestdbus.c
@@ -566,13 +566,12 @@ write_config_file (GTestDBus *self)
       "  </policy>\n"
       "</busconfig>\n");
 
+  close (fd);
   g_file_set_contents (path, contents->str, contents->len, &error);
   g_assert_no_error (error);
 
   g_string_free (contents, TRUE);
 
-  close (fd);
-
   return path;
 }
 


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