mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-26 15:36:14 +01:00
gfile: make_directory_with_parents race condition
A race condition could cause g_file_make_directory_with_parents() to fail with G_IO_ERROR_EXISTS despite the requested directory not existing. https://bugzilla.gnome.org/show_bug.cgi?id=719455
This commit is contained in:
parent
388e0d576f
commit
5a7db3015a
@ -3777,6 +3777,11 @@ g_file_make_directory_with_parents (GFile *file,
|
||||
|
||||
g_clear_error (&my_error);
|
||||
g_file_make_directory (parent_file, cancellable, &my_error);
|
||||
/* Another process may have created the directory in between the
|
||||
* G_IO_ERROR_NOT_FOUND and now
|
||||
*/
|
||||
if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
|
||||
g_clear_error (&my_error);
|
||||
|
||||
g_object_unref (work_file);
|
||||
work_file = g_object_ref (parent_file);
|
||||
@ -3790,6 +3795,8 @@ g_file_make_directory_with_parents (GFile *file,
|
||||
for (l = list; my_error == NULL && l; l = l->next)
|
||||
{
|
||||
g_file_make_directory ((GFile *) l->data, cancellable, &my_error);
|
||||
if (g_error_matches (my_error, G_IO_ERROR, G_IO_ERROR_EXISTS))
|
||||
g_clear_error (&my_error);
|
||||
}
|
||||
|
||||
if (work_file)
|
||||
|
Loading…
Reference in New Issue
Block a user