diff options
author | ru <ru@FreeBSD.org> | 2002-10-31 10:41:51 +0000 |
---|---|---|
committer | ru <ru@FreeBSD.org> | 2002-10-31 10:41:51 +0000 |
commit | c5d62c42fa3a5c2381a487c37c3de2af76383166 (patch) | |
tree | 7d118431ee55be81f034a0d61b529587797f80d6 /usr.bin | |
parent | e0948bce97292254070c1b24394e8c698f4408bd (diff) | |
download | FreeBSD-src-c5d62c42fa3a5c2381a487c37c3de2af76383166.zip FreeBSD-src-c5d62c42fa3a5c2381a487c37c3de2af76383166.tar.gz |
Do not change the target file's inode-change-time if -C is
specified, the target file already exists and the files are
the same, and the target's file flags and mode need not to
be changed.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/xinstall/xinstall.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c index 445d3f8..4d7e683 100644 --- a/usr.bin/xinstall/xinstall.c +++ b/usr.bin/xinstall/xinstall.c @@ -451,7 +451,7 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags) */ if ((gid != (gid_t)-1 && gid != to_sb.st_gid) || (uid != (uid_t)-1 && uid != to_sb.st_uid) || - (mode != to_sb.st_mode)) { + (mode != (to_sb.st_mode & ALLPERMS))) { /* Try to turn off the immutable bits. */ if (to_sb.st_flags & NOCHANGEBITS) (void)fchflags(to_fd, to_sb.st_flags & ~NOCHANGEBITS); @@ -466,7 +466,7 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags) err(EX_OSERR,"%s: chown/chgrp", to_name); } - if (mode != to_sb.st_mode) + if (mode != (to_sb.st_mode & ALLPERMS)) if (fchmod(to_fd, mode)) { serrno = errno; (void)unlink(to_name); @@ -481,7 +481,9 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags) * trying to turn off UF_NODUMP. If we're trying to set real flags, * then warn if the the fs doesn't support it, otherwise fail. */ - if (!devnull && fchflags(to_fd, + if (!devnull && (flags & SETFLAGS || + (from_sb.st_flags & ~UF_NODUMP) != to_sb.st_flags) && + fchflags(to_fd, flags & SETFLAGS ? fset : from_sb.st_flags & ~UF_NODUMP)) { if (flags & SETFLAGS) { if (errno == EOPNOTSUPP) |