Follow symbolic links named as command line arguments if run without -R.

This is required by symlink(7), ``Commands not traversing a file tree''
subsection, third paragraph:

: It is important to realize that this rule includes commands which may
: optionally traverse file trees, e.g. the command ``chown file'' is
: included in this rule, while the command ``chown -R file'' is not.

For chown(8) and chgrp(1), this is also is compliance with the latest
POSIX 1003.1-200x draft.

MFC after:	1 week
This commit is contained in:
Ruslan Ermilov 2001-05-28 12:58:10 +00:00
parent a89ab9bbe4
commit 8e46d9c279
4 changed files with 12 additions and 8 deletions

View File

@ -99,15 +99,16 @@ main(argc, argv)
if (argc < 2)
usage();
fts_options = FTS_PHYSICAL;
if (Rflag) {
fts_options = FTS_PHYSICAL;
if (Hflag)
fts_options |= FTS_COMFOLLOW;
if (Lflag) {
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
}
}
} else
fts_options = FTS_LOGICAL;
flags = *argv;
if (*flags >= '0' && *flags <= '7') {

View File

@ -134,8 +134,8 @@ done: argv += optind;
if (argc < 2)
usage();
fts_options = FTS_PHYSICAL;
if (Rflag) {
fts_options = FTS_PHYSICAL;
if (hflag)
errx(1,
"the -R and -h options may not be specified together.");
@ -145,7 +145,8 @@ done: argv += optind;
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
}
}
} else
fts_options = FTS_LOGICAL;
mode = *argv;
if (*mode >= '0' && *mode <= '7') {

View File

@ -99,15 +99,16 @@ main(argc, argv)
if (argc < 2)
usage();
fts_options = FTS_PHYSICAL;
if (Rflag) {
fts_options = FTS_PHYSICAL;
if (Hflag)
fts_options |= FTS_COMFOLLOW;
if (Lflag) {
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
}
}
} else
fts_options = FTS_LOGICAL;
flags = *argv;
if (*flags >= '0' && *flags <= '7') {

View File

@ -122,8 +122,8 @@ main(argc, argv)
if (argc < 2)
usage();
fts_options = FTS_PHYSICAL;
if (Rflag) {
fts_options = FTS_PHYSICAL;
if (hflag && (Lflag || Hflag))
errx(1, "the -R and -h options may not be specified together");
if (Hflag)
@ -132,7 +132,8 @@ main(argc, argv)
fts_options &= ~FTS_PHYSICAL;
fts_options |= FTS_LOGICAL;
}
}
} else
fts_options = FTS_LOGICAL;
uid = gid = -1;
if (ischown) {