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
1 changed files with 3 additions and 8 deletions

View File

@ -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 = '/';
}