]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
First step towards integrating Mac OS "copyfile" extension from Apple.
authorTim Kientzle <kientzle@gmail.com>
Mon, 1 Feb 2010 05:51:37 +0000 (00:51 -0500)
committerTim Kientzle <kientzle@gmail.com>
Mon, 1 Feb 2010 05:51:37 +0000 (00:51 -0500)
This part adds probes for the copyfile.h header, and adds a new command-line
option --disable-copyfile, which does nothing on non-MacOS systems.

SVN-Revision: 1852

CMakeLists.txt
build/cmake/config.h.in
configure.ac
tar/bsdtar.c
tar/bsdtar.h
tar/cmdline.c

index 42dc9fee555eb84ee6291d4b84ff54c398de6a74..f844e7eb1961478399b8334d8b81f1399a18b6b6 100644 (file)
@@ -213,6 +213,7 @@ LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
 LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H)
 LA_CHECK_INCLUDE_FILE("attr/xattr.h" HAVE_ATTR_XATTR_H)
 LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H)
+LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H)
 LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H)
 LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H)
 LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H)
index 2d2a000e4007bc5b8fd759315ead85442deb860b..dadda86059db5e540b5d91235d4e8e32ddea209f 100644 (file)
@@ -60,6 +60,9 @@
 /* Define to 1 if you have the `chroot' function. */
 #cmakedefine HAVE_CHROOT 1
 
+/* Define to 1 if you have the <copyfile.h> header file. */
+#cmakedefine HAVE_COPYFILE_H 1
+
 /* Define to 1 if you have the `CreateHardLinkA' function. */
 #cmakedefine HAVE_CREATEHARDLINKA 1
 
index 2dcd03fe68c6229b7d8012e9f79a34d6e45d0936..e4beae79e82e8a271cd88ee07ba726e07d7fd5b8 100644 (file)
@@ -192,7 +192,7 @@ esac
 # Checks for header files.
 AC_HEADER_DIRENT
 AC_HEADER_SYS_WAIT
-AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h ctype.h errno.h])
+AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h errno.h])
 AC_CHECK_HEADERS([ext2fs/ext2_fs.h fcntl.h grp.h])
 AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h linux/fs.h])
 AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h regex.h signal.h stdarg.h])
index 39ff453be6370a67f71efaddf71ec9c1bc68f123..caa9e97636d52246f57e9ee945a6db222a3b5da0 100644 (file)
@@ -32,6 +32,9 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/bsdtar.c,v 1.93 2008/11/08 04:43:24 kientzle
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
+#ifdef HAVE_COPYFILE_H
+#include <copyfile.h>
+#endif
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -225,6 +228,11 @@ main(int argc, char **argv)
        }
 #endif
 
+#ifdef COPYFILE_DISABLE_VAR
+       if (getenv(COPYFILE_DISABLE_VAR))
+               bsdtar->disable_copyfile = 1;
+#endif
+
        bsdtar->argv = argv;
        bsdtar->argc = argc;
 
@@ -258,6 +266,9 @@ main(int argc, char **argv)
                case OPTION_CHROOT: /* NetBSD */
                        bsdtar->option_chroot = 1;
                        break;
+               case OPTION_DISABLE_COPYFILE: /* Mac OS X */
+                       bsdtar->disable_copyfile = 1;
+                       break;
                case OPTION_EXCLUDE: /* GNU tar */
                        if (lafe_exclude(&bsdtar->matching, bsdtar->optarg))
                                lafe_errc(1, 0,
index 5e8dc7f89ec57b57f1a3911533d9c9434ee8259e..a9dbd758f3bc449c7ef8c2b3885b1370929e2030 100644 (file)
@@ -74,6 +74,7 @@ struct bsdtar {
        char              option_unlink_first; /* -U */
        char              option_warn_links; /* --check-links */
        char              day_first; /* show day before month in -tv output */
+       char              disable_copyfile; /* For Mac OS */
 
        /* If >= 0, then close this when done. */
        int               fd;
@@ -109,6 +110,7 @@ struct bsdtar {
 enum {
        OPTION_CHECK_LINKS = 1,
        OPTION_CHROOT,
+       OPTION_DISABLE_COPYFILE,
        OPTION_EXCLUDE,
        OPTION_FORMAT,
        OPTION_OPTIONS,
index ba3e8a1b2a88b3c472292e2f4c91b39d29d88bf9..82772abc9e1d72bed7d7780ba5ad0601d669a135 100644 (file)
@@ -77,6 +77,7 @@ static struct option {
        { "create",               0, 'c' },
        { "dereference",          0, 'L' },
        { "directory",            1, 'C' },
+       { "disable-copyfile",     0, OPTION_DISABLE_COPYFILE },
        { "exclude",              1, OPTION_EXCLUDE },
        { "exclude-from",         1, 'X' },
        { "extract",              0, 'x' },