diff options
author | Theodore Ts'o <tytso@mit.edu> | 2004-01-31 21:16:35 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2004-01-31 21:16:35 -0500 |
commit | 3c203cb6831fdfe096bae7ce60c594725f70f47d (patch) | |
tree | 9b778d0ba7d5e33a0b0b85f5276339e424e24982 /lib/e2p/fsetflags.c | |
parent | 2e5a1b9e6e2af21be33ff9871bff34772c7ca7f8 (diff) | |
download | e2fsprogs-3c203cb6831fdfe096bae7ce60c594725f70f47d.tar.gz |
fgetflags.c, fgetversion.c, fsetflags.c, fsetversion.c: Apply
patch from Brian Bergstrand to support ext2_ioctl() in
Darwin. This is implemented via the fsctl system call.
Diffstat (limited to 'lib/e2p/fsetflags.c')
-rw-r--r-- | lib/e2p/fsetflags.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/e2p/fsetflags.c b/lib/e2p/fsetflags.c index 183f7822..8b2eed4c 100644 --- a/lib/e2p/fsetflags.c +++ b/lib/e2p/fsetflags.c @@ -41,7 +41,7 @@ int fsetflags (const char * name, unsigned long flags) { struct stat buf; -#if HAVE_CHFLAGS +#if HAVE_CHFLAGS && !(APPLE_DARWIN && HAVE_EXT2_IOCTLS) unsigned long bsd_flags = 0; #ifdef UF_IMMUTABLE @@ -66,6 +66,7 @@ int fsetflags (const char * name, unsigned long flags) !S_ISREG(buf.st_mode) && !S_ISDIR(buf.st_mode)) { goto notsupp; } +#if !APPLE_DARWIN fd = open (name, OPEN_FLAGS); if (fd == -1) return -1; @@ -76,6 +77,10 @@ int fsetflags (const char * name, unsigned long flags) close (fd); if (save_errno) errno = save_errno; +#else + f = (int) flags; + return syscall(SYS_fsctl, name, EXT2_IOC_SETFLAGS, &f, 0); +#endif return r; #endif /* HAVE_EXT2_IOCTLS */ #endif |