Allow "chown/chgrp -R -h" so we can change trees with symbolic links without

affecting stuff pointed to.  Don't allow "-R -L -h" as it would not make sense
(at least not to me) to follow all symbolic links and then use lchown.
This commit is contained in:
kim 1998-10-05 21:37:38 +00:00
parent d5a92147c7
commit 463d00633e
2 changed files with 10 additions and 14 deletions

View File

@ -30,7 +30,7 @@
.\" SUCH DAMAGE.
.\"
.\" from: @(#)chown.8 8.3 (Berkeley) 3/31/94
.\" $NetBSD: chown.8,v 1.10 1997/12/21 18:11:20 kleink Exp $
.\" $NetBSD: chown.8,v 1.11 1998/10/05 21:37:38 kim Exp $
.\"
.Dd March 31, 1994
.Dt CHOWN 8
@ -86,15 +86,6 @@ If
is a symbolic link, the owner and/or group of the link is changed.
.El
.Pp
If
.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
@ -107,6 +98,12 @@ In addition, these options override each other and the
command's actions are determined by the last one specified.
.Pp
The
.Fl L
option cannot be used together with the
.Fl h
option.
.Pp
The
.Ar owner
and
.Ar group

View File

@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)chown.c 8.8 (Berkeley) 4/4/94";
#else
__RCSID("$NetBSD: chown.c,v 1.14 1997/12/21 18:34:30 kleink Exp $");
__RCSID("$NetBSD: chown.c,v 1.15 1998/10/05 21:37:39 kim Exp $");
#endif
#endif /* not lint */
@ -132,12 +132,11 @@ main(argc, argv)
fts_options = FTS_PHYSICAL;
if (Rflag) {
if (hflag)
errx(1,
"the -R and -h options may not be specified together.");
if (Hflag)
fts_options |= FTS_COMFOLLOW;
if (Lflag) {
if (hflag)
errx(1, "the -L and -h options may not be specified together.");
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
}