summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorkientzle <kientzle@FreeBSD.org>2008-09-14 05:51:25 +0000
committerkientzle <kientzle@FreeBSD.org>2008-09-14 05:51:25 +0000
commitc5756805692bc5c9aa46a089e39efdfd0f9e065b (patch)
treee9b513abea17293704e425d527db9d5199d107af /lib
parenta1df7e8332c2cc422d1d614e0b50462f76175088 (diff)
downloadFreeBSD-src-c5756805692bc5c9aa46a089e39efdfd0f9e065b.zip
FreeBSD-src-c5756805692bc5c9aa46a089e39efdfd0f9e065b.tar.gz
Choose a flag-handling strategy based on platform capabilities
rather than on platform.
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_write_disk.c13
-rw-r--r--lib/libarchive/config_freebsd.h1
2 files changed, 8 insertions, 6 deletions
diff --git a/lib/libarchive/archive_write_disk.c b/lib/libarchive/archive_write_disk.c
index 8b364f2..19c3199 100644
--- a/lib/libarchive/archive_write_disk.c
+++ b/lib/libarchive/archive_write_disk.c
@@ -1963,7 +1963,10 @@ set_fflags(struct archive_write_disk *a)
}
-#if ( defined(HAVE_LCHFLAGS) || defined(HAVE_CHFLAGS) || defined(HAVE_FCHFLAGS) ) && !defined(__linux)
+#if ( defined(HAVE_LCHFLAGS) || defined(HAVE_CHFLAGS) || defined(HAVE_FCHFLAGS) ) && defined(HAVE_STRUCT_STAT_ST_FLAGS)
+/*
+ * BSD reads flags using stat() and sets them with one of {f,l,}chflags()
+ */
static int
set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
mode_t mode, unsigned long set, unsigned long clear)
@@ -2012,11 +2015,9 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
return (ARCHIVE_WARN);
}
-#elif defined(__linux) && defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS)
-
+#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS)
/*
- * Linux has flags too, but uses ioctl() to access them instead of
- * having a separate chflags() system call.
+ * Linux uses ioctl() to read and write file flags.
*/
static int
set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
@@ -2084,7 +2085,7 @@ cleanup:
return (ret);
}
-#else /* Not HAVE_CHFLAGS && Not __linux */
+#else
/*
* Of course, some systems have neither BSD chflags() nor Linux' flags
diff --git a/lib/libarchive/config_freebsd.h b/lib/libarchive/config_freebsd.h
index 4c97bb2..3c25631 100644
--- a/lib/libarchive/config_freebsd.h
+++ b/lib/libarchive/config_freebsd.h
@@ -89,6 +89,7 @@
#define HAVE_STRING_H 1
#define HAVE_STRRCHR 1
#define HAVE_STRUCT_STAT_ST_BLKSIZE 1
+#define HAVE_STRUCT_STAT_ST_FLAGS 1
#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1
#define HAVE_SYS_ACL_H 1
#define HAVE_SYS_IOCTL_H 1
OpenPOWER on IntegriCloud