summaryrefslogtreecommitdiff
path: root/usr/src/cmd/chgrp/chgrp.c
diff options
context:
space:
mode:
authorJerry Jelinek <jerry.jelinek@joyent.com>2019-03-08 12:58:09 +0000
committerJerry Jelinek <jerry.jelinek@joyent.com>2019-03-08 12:58:09 +0000
commitab5c28c720db708bc348bdd2d22dfda8f16ea0f9 (patch)
tree7f2493ed646db49d6c47215efc91f64d8169d92f /usr/src/cmd/chgrp/chgrp.c
parent4e60424f28371f62aa78ec19751822a218d10eb5 (diff)
parent8f5edf1f887948e6be5982cbe7f196909927af91 (diff)
downloadillumos-joyent-ab5c28c720db708bc348bdd2d22dfda8f16ea0f9.tar.gz
[illumos-gate merge]
commit 8f5edf1f887948e6be5982cbe7f196909927af91 10417 recursive chown should not traverse any symbolic links by default commit 0fa1b3cc784fb6db7999ec330ee54256171c1143 10500 Refactor dmu_recv into its own file commit 051a710dcbf091c85ceb0f5d86bd684a64639477 10504 zfs-test deadlist_lock leaves behind orphan destructive dtrace probe commit cbf54fed071131ba3446db06df29807d639650ab 10125 smatch fixes for cmd-inet Conflicts: usr/src/pkg/manifests/system-test-utiltest.mf usr/src/test/util-tests/tests/Makefile usr/src/uts/common/fs/zfs/dmu_send.c usr/src/uts/common/fs/zfs/dmu_recv.c
Diffstat (limited to 'usr/src/cmd/chgrp/chgrp.c')
-rw-r--r--usr/src/cmd/chgrp/chgrp.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/usr/src/cmd/chgrp/chgrp.c b/usr/src/cmd/chgrp/chgrp.c
index a1fe7fefbf..ed27bbd47a 100644
--- a/usr/src/cmd/chgrp/chgrp.c
+++ b/usr/src/cmd/chgrp/chgrp.c
@@ -38,8 +38,6 @@
* contributors.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* chgrp [-fhR] gid file ...
* chgrp -R [-f] [-H|-L|-P] gid file ...
@@ -82,41 +80,18 @@ static int isnumber(char *);
static int Perror(char *);
static void chgrpr(char *, gid_t);
-#ifdef XPG4
-/*
- * Check to see if we are to follow symlinks specified on the command line.
- * This assumes we've already checked to make sure neither -h or -P was
- * specified, so we are just looking to see if -R -L, or -R -H was specified,
- * or, since -R has the same behavior as -R -L, if -R was specified by itself.
- * Therefore, all we really need to check for is if -R was specified.
- */
-#define FOLLOW_CL_LINKS (rflag)
-#else
/*
* Check to see if we are to follow symlinks specified on the command line.
* This assumes we've already checked to make sure neither -h or -P was
* specified, so we are just looking to see if -R -L, or -R -H was specified.
- * Note: -R by itself will change the group of a directory referenced by a
- * symlink however it will not follow the symlink to any other part of the
- * file hierarchy.
*/
#define FOLLOW_CL_LINKS (rflag && (Hflag || Lflag))
-#endif
-#ifdef XPG4
-/*
- * Follow symlinks when traversing directories. Since -R behaves the
- * same as -R -L, we always want to follow symlinks to other parts
- * of the file hierarchy unless -H was specified.
- */
-#define FOLLOW_D_LINKS (!Hflag)
-#else
/*
* Follow symlinks when traversing directories. Only follow symlinks
* to other parts of the file hierarchy if -L was specified.
*/
#define FOLLOW_D_LINKS (Lflag)
-#endif
#define CHOWN(f, u, g) if (chown(f, u, g) < 0) { \
status += Perror(f); \
@@ -185,6 +160,13 @@ main(int argc, char *argv[])
default:
usage();
}
+ /*
+ * Set Pflag by default for recursive operations
+ * if no other options were specified.
+ */
+ if (rflag && !(Lflag || Hflag || Pflag || hflag)) {
+ Pflag = 1;
+ }
/*
* Check for sufficient arguments