]> wimlib.net Git - wimlib/blobdiff - src/unix_apply.c
wimlib.h: C++ compatibility
[wimlib] / src / unix_apply.c
index 3940d33a07cbf85d1ea209e2472ca8033610e99a..86be081ff006cf220ec2850512c8f032deddc00d 100644 (file)
@@ -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;
 }