From f221d6530a88a8eaa5f8e611a2c75aca82c54a41 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Fri, 4 Sep 2009 22:48:51 -0400 Subject: [PATCH] Fix cpio build on MinGW if CreateHardLinkW is unavailable. SVN-Revision: 1424 --- cpio/cpio_windows.c | 6 ++++++ 1 file changed, 6 insertions(+) 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); } -- 2.47.3