]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix cpio build on MinGW if CreateHardLinkW is unavailable.
authorTim Kientzle <kientzle@gmail.com>
Sat, 5 Sep 2009 02:48:51 +0000 (22:48 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sat, 5 Sep 2009 02:48:51 +0000 (22:48 -0400)
SVN-Revision: 1424

cpio/cpio_windows.c

index 5fd2537695aa0ae01149c81dda4c0bb05b5d20a4..f2813c204ea84a7a5a5c03f9f727cdb3de809314 100644 (file)
@@ -204,6 +204,7 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
        return (handle);
 }
 
+#if HAVE_CREATEHARDLINKW
 static size_t
 wequallen(const wchar_t *s1, const wchar_t *s2)
 {
@@ -283,6 +284,7 @@ canHardLinkW(const wchar_t *path1, const wchar_t *path2)
        else
                return (0);
 }
+#endif
 
 /* Make a link to src called dst.  */
 static int
@@ -314,9 +316,11 @@ __link(const char *src, const char *dst, int sym)
                        retval = -1;
                        goto exit;
                }
+#if HAVE_CREATEHARDLINKW
                if (!sym && canHardLinkW(wsrc, wdst))
                        res = CreateHardLinkW(wdst, wsrc, NULL);
                else
+#endif
                        res = CopyFileW(wsrc, wdst, FALSE);
        } else {
                /* wsrc does not exist; try src prepend it with the dirname of wdst */
@@ -373,9 +377,11 @@ __link(const char *src, const char *dst, int sym)
                        retval = -1;
                        goto exit;
                }
+#if HAVE_CREATEHARDLINKW
                if (!sym && canHardLinkW(wnewsrc, wdst))
                        res = CreateHardLinkW(wdst, wnewsrc, NULL);
                else
+#endif
                        res = CopyFileW(wnewsrc, wdst, FALSE);
                free (wnewsrc);
        }