From 2a1fde25c893b25b82594a88d7ce93d2cf786b03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Dubois?= Date: Wed, 12 Jul 2017 14:47:08 -0400 Subject: [PATCH] Fixed PathMakePathA (returned true even if it can't create the last folder of the path) --- winpr/libwinpr/path/shell.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/winpr/libwinpr/path/shell.c b/winpr/libwinpr/path/shell.c index 386cac37d..891ce9837 100644 --- a/winpr/libwinpr/path/shell.c +++ b/winpr/libwinpr/path/shell.c @@ -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 }