Source-Changes-HG archive

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

[src/trunk]: src Align default behaviour of chmod, chgrp, chown, and chflags ...



details:   https://anonhg.NetBSD.org/src/rev/c90b06f3eb60
branches:  trunk
changeset: 533683:c90b06f3eb60
user:      bjh21 <bjh21%NetBSD.org@localhost>
date:      Sun Jul 07 11:44:02 2002 +0000

description:
Align default behaviour of chmod, chgrp, chown, and chflags with symlink(7),
IEEE 1003.1-2001 (where applicable) and other systems, by follwoing symlinks
on the command line and changing their targets' modes/ownership/flags, rather
than ignoring them.

This fixes PR standards/563 (at last).

diffstat:

 bin/chmod/chmod.1         |  12 +-----------
 bin/chmod/chmod.c         |   7 ++++---
 usr.bin/chflags/chflags.c |   7 ++++---
 usr.sbin/chown/chown.c    |   7 ++++---
 4 files changed, 13 insertions(+), 20 deletions(-)

diffs (110 lines):

diff -r f9276aa45362 -r c90b06f3eb60 bin/chmod/chmod.1
--- a/bin/chmod/chmod.1 Sun Jul 07 10:52:18 2002 +0000
+++ b/bin/chmod/chmod.1 Sun Jul 07 11:44:02 2002 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: chmod.1,v 1.17 2002/02/08 01:21:55 ross Exp $
+.\"    $NetBSD: chmod.1,v 1.18 2002/07/07 11:44:02 bjh21 Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993, 1994
 .\"    The Regents of the University of California.  All rights reserved.
@@ -82,16 +82,6 @@
 .Ar file
 is symbolic link, the mode of the link is changed.
 .El
-.Pp
-If the option
-.Fl h
-is not given, unless the
-.Fl H
-or
-.Fl L
-option is set,
-.Nm
-on a symbolic link always succeeds and has no effect.
 The
 .Fl H ,
 .Fl L
diff -r f9276aa45362 -r c90b06f3eb60 bin/chmod/chmod.c
--- a/bin/chmod/chmod.c Sun Jul 07 10:52:18 2002 +0000
+++ b/bin/chmod/chmod.c Sun Jul 07 11:44:02 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chmod.c,v 1.27 2002/05/31 18:54:01 bjh21 Exp $ */
+/* $NetBSD: chmod.c,v 1.28 2002/07/07 11:44:02 bjh21 Exp $ */
 
 /*
  * Copyright (c) 1989, 1993, 1994
@@ -44,7 +44,7 @@
 #if 0
 static char sccsid[] = "@(#)chmod.c    8.8 (Berkeley) 4/1/94";
 #else
-__RCSID("$NetBSD: chmod.c,v 1.27 2002/05/31 18:54:01 bjh21 Exp $");
+__RCSID("$NetBSD: chmod.c,v 1.28 2002/07/07 11:44:02 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -142,7 +142,8 @@
                        fts_options &= ~FTS_PHYSICAL;
                        fts_options |= FTS_LOGICAL;
                }
-       }
+       } else if (!hflag)
+               fts_options |= FTS_COMFOLLOW;
        if (hflag)
                change_mode = lchmod;
        else
diff -r f9276aa45362 -r c90b06f3eb60 usr.bin/chflags/chflags.c
--- a/usr.bin/chflags/chflags.c Sun Jul 07 10:52:18 2002 +0000
+++ b/usr.bin/chflags/chflags.c Sun Jul 07 11:44:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chflags.c,v 1.8 2000/08/04 08:06:57 enami Exp $        */
+/*     $NetBSD: chflags.c,v 1.9 2002/07/07 11:44:03 bjh21 Exp $        */
 
 /*
  * Copyright (c) 1992, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "from: @(#)chflags.c    8.5 (Berkeley) 4/1/94";
 #else
-__RCSID("$NetBSD: chflags.c,v 1.8 2000/08/04 08:06:57 enami Exp $");
+__RCSID("$NetBSD: chflags.c,v 1.9 2002/07/07 11:44:03 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -114,7 +114,8 @@
                        fts_options &= ~FTS_PHYSICAL;
                        fts_options |= FTS_LOGICAL;
                }
-       }
+       } else if (!hflag)
+               fts_options |= FTS_COMFOLLOW;
 
        flags = *argv;
        if (*flags >= '0' && *flags <= '7') {
diff -r f9276aa45362 -r c90b06f3eb60 usr.sbin/chown/chown.c
--- a/usr.sbin/chown/chown.c    Sun Jul 07 10:52:18 2002 +0000
+++ b/usr.sbin/chown/chown.c    Sun Jul 07 11:44:02 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chown.c,v 1.25 2000/12/17 22:47:14 mike Exp $  */
+/*     $NetBSD: chown.c,v 1.26 2002/07/07 11:44:03 bjh21 Exp $ */
 
 /*
  * Copyright (c) 1988, 1993, 1994
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)chown.c    8.8 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: chown.c,v 1.25 2000/12/17 22:47:14 mike Exp $");
+__RCSID("$NetBSD: chown.c,v 1.26 2002/07/07 11:44:03 bjh21 Exp $");
 #endif
 #endif /* not lint */
 
@@ -142,7 +142,8 @@
                        fts_options &= ~FTS_PHYSICAL;
                        fts_options |= FTS_LOGICAL;
                }
-       }
+       } else if (!hflag)
+               fts_options |= FTS_COMFOLLOW;
 
        uid = (uid_t)-1;
        gid = (gid_t)-1;



Home | Main Index | Thread Index | Old Index