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;
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to