[glib/wip/carlosg/fix-mkdir-with-parents-errors] gfileutils: Fix error propagation for other than ENOENT



commit 3a4a66508378cfb0c794a3760666f560bbea358b
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Aug 8 02:19:39 2019 +0200

    gfileutils: Fix error propagation for other than ENOENT
    
    Commit 6f55306e04e5 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

 glib/gfileutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gfileutils.c b/glib/gfileutils.c
index 275647509..f0799e212 100644
--- a/glib/gfileutils.c
+++ b/glib/gfileutils.c
@@ -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;


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