Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Jan 2013 16:04:40 +0000 (UTC)
From:      Brooks Davis <brooks@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r246147 - head/usr.bin/xinstall
Message-ID:  <201301311604.r0VG4e1c034329@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: brooks
Date: Thu Jan 31 16:04:40 2013
New Revision: 246147
URL: http://svnweb.freebsd.org/changeset/base/246147

Log:
  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

Modified:
  head/usr.bin/xinstall/xinstall.c

Modified: head/usr.bin/xinstall/xinstall.c
==============================================================================
--- head/usr.bin/xinstall/xinstall.c	Thu Jan 31 14:07:24 2013	(r246146)
+++ head/usr.bin/xinstall/xinstall.c	Thu Jan 31 16:04:40 2013	(r246147)
@@ -953,9 +953,8 @@ install(const char *from_name, const cha
 		}
 
 	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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201301311604.r0VG4e1c034329>