diff options
| author | Owen W. Taylor <otaylor@fishsoup.net> | 2012-07-30 11:33:05 (GMT) |
|---|---|---|
| committer | Owen W. Taylor <otaylor@fishsoup.net> | 2012-07-30 16:29:26 (GMT) |
| commit | b0bce4ad41937dabf7e5c94dcce3caf4e88f3f97 (patch) | |
| tree | 3cad30068647ddb8db068335962b03898da87ada | |
| parent | d7829ced532a5ffba4c56772a7a4b24e3e228651 (diff) | |
| download | glib-b0bce4ad41937dabf7e5c94dcce3caf4e88f3f97.zip glib-b0bce4ad41937dabf7e5c94dcce3caf4e88f3f97.tar.xz | |
g_file_make_directory_with_parents: Fix error propagation
When creating a directory fails for some reason other than
the parent not existing, don't clear the error before we try
to propagate it.
To reproduce, run 'ostadmin init' on /ostree or otherwise try to
run the function on a directory with a parent directory where the
current user is not allowed to write.
https://bugzilla.gnome.org/show_bug.cgi?id=680823
| -rw-r--r-- | gio/gfile.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gio/gfile.c b/gio/gfile.c index f664875..3bdae74 100644 --- a/gio/gfile.c +++ b/gio/gfile.c @@ -3395,12 +3395,14 @@ g_file_make_directory_with_parents (GFile *file, work_file = g_object_ref (parent_file); if (!result && my_error->code == G_IO_ERROR_NOT_FOUND) - list = g_list_prepend (list, parent_file); /* Transfer ownership of ref */ + { + g_clear_error (&my_error); + list = g_list_prepend (list, parent_file); /* Transfer ownership of ref */ + } else g_object_unref (parent_file); } - g_clear_error (&my_error); for (l = list; result && l; l = l->next) { result = g_file_make_directory ((GFile *) l->data, cancellable, &my_error); |