Fixed directory creation for POSIX targets

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]
This commit is contained in:
alexey.lysiuk 2017-12-03 14:50:32 +02:00
parent 5f50d60eff
commit 31b0fdc9fe

View file

@ -544,18 +544,13 @@ void CreatePath(const char *fn)
{ {
*p = '\0'; *p = '\0';
} }
struct stat info; if (!DirEntryExists(copy) && mkdir(copy, 0755) == -1)
if (DirEntryExists(copy))
{ {
if (info.st_mode & S_IFDIR) // failed
goto exists;
}
if (mkdir(copy, 0755) == -1)
{ // failed
free(copy); free(copy);
return; return;
} }
exists: if (p != NULL) if (p != NULL)
{ {
*p = '/'; *p = '/';
} }