From 31b0fdc9fe1179bfa799e5c43d379933624661ae Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sun, 3 Dec 2017 14:50:32 +0200 Subject: [PATCH] Fixed directory creation for POSIX targets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Warning was reported by GCC 7 only: cmdlib.cpp:550:13: warning: ‘info.stat::st_mode’ may be used uninitialized in this function [-Wmaybe-uninitialized] --- src/cmdlib.cpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/cmdlib.cpp b/src/cmdlib.cpp index bccb4afcd6..e58b3569f4 100644 --- a/src/cmdlib.cpp +++ b/src/cmdlib.cpp @@ -544,18 +544,13 @@ void CreatePath(const char *fn) { *p = '\0'; } - struct stat info; - if (DirEntryExists(copy)) + if (!DirEntryExists(copy) && mkdir(copy, 0755) == -1) { - if (info.st_mode & S_IFDIR) - goto exists; - } - if (mkdir(copy, 0755) == -1) - { // failed + // failed free(copy); return; } -exists: if (p != NULL) + if (p != NULL) { *p = '/'; }