]> wimlib.net Git - wimlib/blobdiff - src/unix_apply.c
verify_swm_set(): Check chunk size
[wimlib] / src / unix_apply.c
index 026042bce7219fe1baecfcf5d726b7d40790d73f..86be081ff006cf220ec2850512c8f032deddc00d 100644 (file)
@@ -72,10 +72,10 @@ unix_create_directory(const tchar *path, struct apply_ctx *ctx, u64 *cookie_ret)
                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;
 }
@@ -85,14 +85,12 @@ unix_makelink(const tchar *oldpath, const tchar *newpath,
              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;
 }