g_file_make_directory_with_parents(): fix a corner case
authorOwen W. Taylor <otaylor@fishsoup.net>
Tue, 14 Aug 2012 15:20:16 +0000 (11:20 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 16 Aug 2012 22:08:05 +0000 (18:08 -0400)
If g_file_get_parent() unexpectedly failed, we could return
FALSE but with no error.

https://bugzilla.gnome.org/show_bug.cgi?id=680823

gio/gfile.c

index 68207ac..92776af 100644 (file)
@@ -3384,11 +3384,12 @@ g_file_make_directory_with_parents (GFile         *file,
     {
       GFile *parent_file;
 
-      g_clear_error (&my_error);
-
       parent_file = g_file_get_parent (work_file);
       if (parent_file == NULL)
         break;
+
+      g_clear_error (&my_error);
+
       result = g_file_make_directory (parent_file, cancellable, &my_error);
 
       g_object_unref (work_file);