From: Tim Kientzle Date: Sat, 5 Sep 2009 02:48:51 +0000 (-0400) Subject: Fix cpio build on MinGW if CreateHardLinkW is unavailable. X-Git-Tag: v2.8.0~384 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f221d6530a88a8eaa5f8e611a2c75aca82c54a41;p=thirdparty%2Flibarchive.git Fix cpio build on MinGW if CreateHardLinkW is unavailable. SVN-Revision: 1424 --- diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c index 5fd253769..f2813c204 100644 --- a/cpio/cpio_windows.c +++ b/cpio/cpio_windows.c @@ -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); }