fix: _psCreateFolder creates the dir without relying on realpath side effects
linux / build (push) Successful in 22m37s
release / release (push) Successful in 18m41s

This commit is contained in:
2026-11-29 18:41:46 +00:00
parent 0906c95693
commit 62498539b2
+5 -8
View File
@@ -120,14 +120,11 @@ void _psCreateFolder(const char *path)
CloseHandle(hfle);
#else
struct stat info;
char fullpath[PATH_MAX];
realpath(path, fullpath);
if (lstat(fullpath, &info) != 0) {
if (errno == ENOENT || (errno != EACCES && !S_ISDIR(info.st_mode))) {
mkdir(fullpath, 0755);
}
}
// realpath() can't resolve the folder before it exists and leaves its output
// buffer unspecified when it returns NULL, so create the folder from the path
// as given instead of trusting the resolved buffer.
if (lstat(path, &info) != 0 && errno == ENOENT)
mkdir(path, 0755);
#endif
}