summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorbrooks <brooks@FreeBSD.org>2013-01-31 16:04:40 +0000
committerbrooks <brooks@FreeBSD.org>2013-01-31 16:04:40 +0000
commit96dbcebea0dd37d6891a4dff6c621d8550f93769 (patch)
tree124e6648e770fd1d9c50d81caf115d655a8efdc7 /usr.bin
parentb27d66677a42ee60c6e31598d42eca18fd6c6484 (diff)
downloadFreeBSD-src-96dbcebea0dd37d6891a4dff6c621d8550f93769.zip
FreeBSD-src-96dbcebea0dd37d6891a4dff6c621d8550f93769.tar.gz
When in -U mode do avoid setting SUID bits, but do not modify the mode
variable so the intended mode can be logged correctly if -M is specified. Sponsored by: DARPA, AFRL
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/xinstall/xinstall.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.bin/xinstall/xinstall.c b/usr.bin/xinstall/xinstall.c
index a173873..15b115a 100644
--- a/usr.bin/xinstall/xinstall.c
+++ b/usr.bin/xinstall/xinstall.c
@@ -953,9 +953,8 @@ install(const char *from_name, const char *to_name, u_long fset, u_int flags)
}
if (mode != (to_sb.st_mode & ALLPERMS)) {
- if (dounpriv)
- mode &= S_IRWXU|S_IRWXG|S_IRWXO;
- if (fchmod(to_fd, mode)) {
+ if (fchmod(to_fd,
+ dounpriv ? mode & (S_IRWXU|S_IRWXG|S_IRWXO) : mode)) {
serrno = errno;
(void)unlink(to_name);
errno = serrno;
OpenPOWER on IntegriCloud