diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-08 12:58:09 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2019-03-08 12:58:09 +0000 |
commit | ab5c28c720db708bc348bdd2d22dfda8f16ea0f9 (patch) | |
tree | 7f2493ed646db49d6c47215efc91f64d8169d92f /usr/src/cmd/chgrp | |
parent | 4e60424f28371f62aa78ec19751822a218d10eb5 (diff) | |
parent | 8f5edf1f887948e6be5982cbe7f196909927af91 (diff) | |
download | illumos-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')
-rw-r--r-- | usr/src/cmd/chgrp/Makefile | 28 | ||||
-rw-r--r-- | usr/src/cmd/chgrp/chgrp.c | 32 |
2 files changed, 15 insertions, 45 deletions
diff --git a/usr/src/cmd/chgrp/Makefile b/usr/src/cmd/chgrp/Makefile index cac25266b7..7de84a25df 100644 --- a/usr/src/cmd/chgrp/Makefile +++ b/usr/src/cmd/chgrp/Makefile @@ -19,49 +19,37 @@ # CDDL HEADER END # # -#ident "%Z%%M% %I% %E% SMI" -# # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # PROG= chgrp -XPG4PROG= chgrp -XD= exobjs.xpg4 EXOBJS= chgrp.o -XPG4EXOBJS= exobjs.xpg4/chgrp.o include ../Makefile.cmd -$(XPG4) := CFLAGS += -DXPG4 +ROOTXPG4LINK=$(ROOTXPG4BIN)/$(PROG) + CPPFLAGS += -D_FILE_OFFSET_BITS=64 LDLIBS += -lcmdutils -lsec .KEEP_STATE: -all: $(PROG) $(XPG4) +all: $(PROG) $(PROG): $(EXOBJS) $(LINK.c) -o $@ $(EXOBJS) $(LDLIBS) $(POST_PROCESS) -$(XPG4): $(XD) $(XPG4EXOBJS) - $(LINK.c) -o $@ $(XPG4EXOBJS) $(LDLIBS) - $(POST_PROCESS) +$(ROOTXPG4LINK): $(ROOTPROG) + -$(RM) $@ + -$(SYMLINK) ../../bin/chgrp $@ -install: all $(ROOTPROG) $(ROOTXPG4PROG) +install: all $(ROOTPROG) $(ROOTXPG4LINK) clean: - -@rm -rf $(EXOBJS) $(XD) + -@rm -rf $(EXOBJS) lint: lint_PROG -$(XPG4EXOBJS): $(XD) - -$(XD)/%.o: %.c - $(COMPILE.c) -o $@ $< - -$(XD): - -@mkdir -p $@ - include ../Makefile.targ 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 |