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
This commit is contained in:
Brooks Davis 2013-01-31 16:04:40 +00:00
parent 4b6b0f4163
commit 7a06a9247d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=246147

View File

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