Fixed PathMakePathA (returned true even if it can't create the last folder of the...
authorFrançois Dubois <fdubois@devolutions.net>
Wed, 12 Jul 2017 18:47:08 +0000 (14:47 -0400)
committerFrançois Dubois <fdubois@devolutions.net>
Wed, 12 Jul 2017 18:47:08 +0000 (14:47 -0400)
winpr/libwinpr/path/shell.c

index 386cac3..891ce98 100644 (file)
@@ -465,6 +465,7 @@ BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
        const char delim = PathGetSeparatorA(PATH_STYLE_NATIVE);
        char* dup;
        char* p;
+       BOOL result = TRUE;
 
        /* we only operate on a non-null, absolute path */
        if (!path || *path != delim)
@@ -480,14 +481,17 @@ BOOL PathMakePathA(LPCSTR path, LPSECURITY_ATTRIBUTES lpAttributes)
 
                if (mkdir(dup, 0777) != 0)
                        if (errno != EEXIST)
+                       {
+                               result = FALSE;
                                break;
+                       }
 
                if (p)
                        *p = delim;
        }
 
        free(dup);
-       return (p == NULL);
+       return (result);
 #endif
 }