Unix (at least Linux) man pages for mkdir(2) document the EEXIST

error: "pathname already exists (not necessarily as a directory).
This includes the case where pathname is a symbolic link, dangling
or not." So, add a check to see if the existing pathname is really
a directory.

git-svn-id: svn+ssh://svn.code.sf.net/p/quakespasm/code/trunk@901 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
sezero 2014-04-24 08:10:15 +00:00
parent e1a715de69
commit 109050b311
2 changed files with 6 additions and 26 deletions

View file

@ -152,7 +152,11 @@ void Sys_mkdir (const char *path)
{
int rc = mkdir (path, 0777);
if (rc != 0 && errno == EEXIST)
rc = 0;
{
struct stat st;
if (stat(path, &st) == 0 && S_ISDIR(st.st_mode))
rc = 0;
}
if (rc != 0)
{
rc = errno;
@ -265,15 +269,3 @@ void Sys_SendKeyEvents (void)
IN_SendKeyEvents();
}
void Sys_LowFPPrecision (void)
{
}
void Sys_HighFPPrecision (void)
{
}
void Sys_SetFPCW (void)
{
}

View file

@ -153,7 +153,7 @@ void Sys_Init (void)
OSVERSIONINFO vinfo;
host_parms->userdir = host_parms->basedir;
/* user directories not really necessary for windows guys.
/* userdirs not really necessary for windows guys.
* can be done if necessary, though... */
vinfo.dwOSVersionInfoSize = sizeof(vinfo);
@ -358,15 +358,3 @@ void Sys_SendKeyEvents (void)
IN_SendKeyEvents();
}
void Sys_LowFPPrecision (void)
{
}
void Sys_HighFPPrecision (void)
{
}
void Sys_SetFPCW (void)
{
}