From: Tim Kientzle Date: Thu, 24 Sep 2009 15:11:32 +0000 (-0400) Subject: Fix tar archiving of hardlinks on Windows: tree.c uses X-Git-Tag: v2.8.0~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ef8967c4de7059ba00878bee82e8ceb3d28dd1c0;p=thirdparty%2Flibarchive.git Fix tar archiving of hardlinks on Windows: tree.c uses Windows stat() call which doesn't actually provide link count or inode values. Passing this data down into libarchive (to avoid redundant stat() calls) meant that hardlink detection simply failed on Windows. Until I can work up something better, this simply avoids passing stat() data from tree down into libarchive on Windows. This allows libarchive to do the GetFileInfoByHandle which provides useful information. SVN-Revision: 1465 --- diff --git a/tar/write.c b/tar/write.c index c25a9af2e..1d41bb36f 100644 --- a/tar/write.c +++ b/tar/write.c @@ -798,6 +798,22 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) * calling this so we can pass in an fd and shorten * the race to query metadata. The linkify dance * makes this more complex than it might sound. */ +#if defined(_WIN32) && !defined(__CYGWIN__) + /* TODO: tree.c uses stat(), which is badly broken + * on Windows. To fix this, we should + * deprecate tree_current_stat() and provide a new + * call tree_populate_entry(t, entry). This call + * would use stat() internally on POSIX and + * GetInfoByFileHandle() internally on Windows. + * This would be another step towards a tree-walker + * that can be integrated deep into libarchive. + * For now, just set st to NULL on Windows; + * archive_read_disk_entry_from_file() should + * be smart enough to use platform-appropriate + * ways to probe file information. + */ + st = NULL; +#endif r = archive_read_disk_entry_from_file(bsdtar->diskreader, entry, -1, st); if (r != ARCHIVE_OK)