if (errno != EEXIST)
return WIMLIB_ERR_MKDIR;
if (lstat(path, &stbuf))
- return WIMLIB_ERR_STAT;
+ return WIMLIB_ERR_MKDIR;
errno = EEXIST;
if (!S_ISDIR(stbuf.st_mode))
- return WIMLIB_ERR_NOTDIR;
+ return WIMLIB_ERR_MKDIR;
}
return 0;
}
int (*makelink)(const tchar *oldpath, const tchar *newpath))
{
if ((*makelink)(oldpath, newpath)) {
- if (errno == EEXIST) {
- if (unlink(newpath))
- return WIMLIB_ERR_LINK;
- if ((*makelink)(oldpath, newpath))
- return WIMLIB_ERR_LINK;
- return 0;
- }
- return WIMLIB_ERR_LINK;
+ if (errno != EEXIST)
+ return WIMLIB_ERR_LINK;
+ if (unlink(newpath))
+ return WIMLIB_ERR_LINK;
+ if ((*makelink)(oldpath, newpath))
+ return WIMLIB_ERR_LINK;
}
return 0;
}