Choose a flag-handling strategy based on platform capabilities

rather than on platform.
This commit is contained in:
Tim Kientzle 2008-09-14 05:51:25 +00:00
parent 8cd2f9bcd0
commit 29a23c776a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=183011
2 changed files with 8 additions and 6 deletions

View File

@ -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 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
return (ret);
}
#else /* Not HAVE_CHFLAGS && Not __linux */
#else
/*
* Of course, some systems have neither BSD chflags() nor Linux' flags

View File

@ -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