Do not try to create directories that already exist.

It seem that solaris will return EACCESS instead of EEXIST if the user
doesn't have write permission in the parent directory.
This commit is contained in:
Bill Currie 2013-02-20 14:03:03 +09:00
parent a611ad57de
commit 32b76b3576

View file

@ -199,9 +199,7 @@ Sys_mkdir (const char *path)
# error do not know how to make directories
# endif
#endif
if (errno != EEXIST)
return -1;
return 0;
return -1;
}
VISIBLE int
@ -869,10 +867,13 @@ Sys_CreatePath (const char *path)
strcpy (e_path, path);
for (ofs = e_path + 1; *ofs; ofs++) {
if (*ofs == '/') { // create the directory
if (*ofs == '/') {
*ofs = 0;
if (Sys_mkdir (e_path) == -1)
return -1;
if (!Sys_isdir (e_path)) {
// create the directory
if (Sys_mkdir (e_path) == -1)
return -1;
}
*ofs = '/';
}
}