gfileutils: Fix error propagation for other than ENOENT

Commit 6f55306e04 unintendedly broke error handling for other
error conditions than ENOENT along the path, like EPERM. It wanted
to ignore ENOENT on all elements except the last in the path, but
in doing that it ignored any other error that might happen on the
last element.

https://gitlab.gnome.org/GNOME/glib/issues/1852
This commit is contained in:
Carlos Garnacho 2019-08-08 02:19:39 +02:00
parent 179fdc5239
commit 3a4a665083

View File

@ -262,7 +262,7 @@ g_mkdir_with_parents (const gchar *pathname,
if (g_mkdir (fn, mode) == -1 && errno != EEXIST)
{
int errno_save = errno;
if (p && errno != ENOENT)
if (errno != ENOENT || !p)
{
g_free (fn);
errno = errno_save;