]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix tar archiving of hardlinks on Windows: tree.c uses
authorTim Kientzle <kientzle@gmail.com>
Thu, 24 Sep 2009 15:11:32 +0000 (11:11 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 24 Sep 2009 15:11:32 +0000 (11:11 -0400)
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

tar/write.c

index c25a9af2ee026b0c1bf62b8fdd8cd54b59e7a47d..1d41bb36fdee309253a315307df79d4afe0b67eb 100644 (file)
@@ -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)