Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xinstall Actually do a chmod if -U, but only try chm...



details:   https://anonhg.NetBSD.org/src/rev/39d7ea967589
branches:  trunk
changeset: 517418:39d7ea967589
user:      tv <tv%NetBSD.org@localhost>
date:      Mon Nov 12 19:08:31 2001 +0000

description:
Actually do a chmod if -U, but only try chmod'ing the lower 0777 bits.
This is needed to make things executable, where appropriate.

diffstat:

 usr.bin/xinstall/xinstall.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r b3eca41800aa -r 39d7ea967589 usr.bin/xinstall/xinstall.c
--- a/usr.bin/xinstall/xinstall.c       Mon Nov 12 18:53:40 2001 +0000
+++ b/usr.bin/xinstall/xinstall.c       Mon Nov 12 19:08:31 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: xinstall.c,v 1.57 2001/10/29 02:57:21 lukem Exp $      */
+/*     $NetBSD: xinstall.c,v 1.58 2001/11/12 19:08:31 tv Exp $ */
 
 /*
  * Copyright (c) 1987, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)xinstall.c 8.1 (Berkeley) 7/21/93";
 #else
-__RCSID("$NetBSD: xinstall.c,v 1.57 2001/10/29 02:57:21 lukem Exp $");
+__RCSID("$NetBSD: xinstall.c,v 1.58 2001/11/12 19:08:31 tv Exp $");
 #endif
 #endif /* not lint */
 
@@ -503,7 +503,9 @@
                (void)unlink(to_name);
                errx(1, "%s: chown/chgrp: %s", to_name, strerror(serrno));
        }
-       if (!dounpriv && fchmod(to_fd, mode) == -1) {
+       if (dounpriv)
+               mode &= S_IRWXU|S_IRWXG|S_IRWXO;
+       if (fchmod(to_fd, mode) == -1) {
                serrno = errno;
                (void)unlink(to_name);
                errx(1, "%s: chmod: %s", to_name, strerror(serrno));



Home | Main Index | Thread Index | Old Index