diff options
Diffstat (limited to 'usr/src/cmd')
-rw-r--r-- | usr/src/cmd/chgrp/Makefile | 28 | ||||
-rw-r--r-- | usr/src/cmd/chgrp/chgrp.c | 32 | ||||
-rw-r--r-- | usr/src/cmd/chown/Makefile | 29 | ||||
-rw-r--r-- | usr/src/cmd/chown/chown.c | 34 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c | 7 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c | 5 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c | 4 | ||||
-rw-r--r-- | usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/ksh/builtins/alias.c | 6 |
9 files changed, 49 insertions, 105 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 diff --git a/usr/src/cmd/chown/Makefile b/usr/src/cmd/chown/Makefile index 622030cf38..9ee61bfc5f 100644 --- a/usr/src/cmd/chown/Makefile +++ b/usr/src/cmd/chown/Makefile @@ -19,50 +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= chown -XPG4PROG= chown -XD= exobjs.xpg4 EXOBJS= chown.o -XPG4EXOBJS= exobjs.xpg4/chown.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/chown $@ -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/chown/chown.c b/usr/src/cmd/chown/chown.c index 319f571384..15db448a5b 100644 --- a/usr/src/cmd/chown/chown.c +++ b/usr/src/cmd/chown/chown.c @@ -24,15 +24,13 @@ */ /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ -/* All Rights Reserved */ +/* All Rights Reserved */ /* * Portions of this source code were derived from Berkeley 4.3 BSD * under license from the Regents of the University of California. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * chown [-fhR] uid[:gid] file ... * chown -R [-f] [-H|-L|-P] uid[:gid] file ... @@ -76,41 +74,18 @@ static int isnumber(char *); static void chownr(char *, uid_t, gid_t); static void usage(); -#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 -H, or -R -L 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 -H, or -R -L was specified. - * Note: -R by itself will change the ownership of a directory referenced by a - * symlink however it will now 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); \ @@ -180,6 +155,13 @@ main(int argc, char *argv[]) } } /* + * 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 * or a usage error. */ diff --git a/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c b/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c index ce361e9c37..a96fa32ba8 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c +++ b/usr/src/cmd/cmd-inet/usr.bin/pppd/plugins/passprompt.c @@ -8,6 +8,11 @@ * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ + +/* + * Copyright (c) 2018, Joyent, Inc. + */ + #include <errno.h> #include <unistd.h> #include <fcntl.h> @@ -70,7 +75,7 @@ static int promptpass(char *user, char *passwd) argv[0] = promptprog; argv[1] = user == NULL ? "" : user; argv[2] = remote_name; - slprintf(fdstr, sizeof (fdstr), "%d", p[1]); + (void) slprintf(fdstr, sizeof (fdstr), "%d", p[1]); argv[3] = fdstr; argv[4] = NULL; (void) execv(*argv, argv); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c b/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c index 4dbbb83590..30e2f0f549 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c @@ -22,7 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2017 Nexenta Systems, Inc. - * Copyright 2017 Joyent, Inc. + * Copyright (c) 2018, Joyent, Inc. * Copyright 2017 Gary Mills * Copyright (c) 2016, Chris Fraire <cfraire@me.com>. */ @@ -1636,8 +1636,7 @@ is_from_gz(const char *lifname) if (if_info->ifi_cflags & IFIF_L3PROTECT) ret = _B_TRUE; - if (if_info) - ipadm_free_if_info(if_info); + ipadm_free_if_info(if_info); return (ret); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c b/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c index c6f8257ae9..9f959976a8 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/ping/ping.c @@ -38,7 +38,7 @@ */ /* - * Copyright (c) 2017, Joyent, Inc. + * Copyright (c) 2018, Joyent, Inc. */ #include <assert.h> @@ -1989,7 +1989,7 @@ recv_icmp_packet(struct addrinfo *ai_dst, int recv_sock6, int recv_sock, progname, strerror(errno)); } continue; - } if (cc > 0) { + } else if (cc > 0) { check_reply(ai_dst, &in_msg, cc, udp_src_port); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c b/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c index ad5100c1b0..5a9dc9889b 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/wificonfig/wificonfig.c @@ -23,7 +23,9 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* + * Copyright (c) 2018, Joyent, Inc. + */ #include <stdio.h> #include <stdlib.h> @@ -2531,7 +2533,7 @@ do_deletepf(int fd, int argc, char **argv) B_FALSE); free(section_id); p_section = p_sectionbak; - continue; + continue; } p_section = p_section->section_next; } @@ -2751,8 +2753,9 @@ do_rmprefer(int fd, int argc, char **argv) return (B_FALSE); pae = plist->ael_head; while (pae != NULL) { + ae_t *next = pae->ae_next; free(pae); - pae = pae->ae_next; + pae = next; } plist->ael_head = plist->ael_tail = NULL; plist->ael_argc = 0; diff --git a/usr/src/cmd/ksh/builtins/alias.c b/usr/src/cmd/ksh/builtins/alias.c index a17e2dabd1..88edbc1e9b 100644 --- a/usr/src/cmd/ksh/builtins/alias.c +++ b/usr/src/cmd/ksh/builtins/alias.c @@ -68,9 +68,7 @@ bfastpathrec fastpath_builtins[] = /* This list must be alphabetically sorted for |strcmp()| usage */ { "basename", b_basename }, { "cat", b_cat }, - { "chgrp", b_chgrp }, { "chmod", b_chmod }, - { "chown", b_chown }, #ifdef ENABLE_PERFORMANCE_PARADOXON { "cksum", b_cksum }, #endif /* ENABLE_PERFORMANCE_PARADOXON */ @@ -98,7 +96,7 @@ bfastpathrec fastpath_builtins[] = { "mkfifo", b_mkfifo }, { "mktemp", b_mktemp }, { "mv", b_mv }, - { "paste", b_paste }, + { "paste", b_paste }, { "pathchk", b_pathchk }, { "pids", b_pids }, { "readlink", b_readlink }, @@ -119,7 +117,7 @@ bfastpathrec fastpath_builtins[] = { "uniq", b_uniq }, { "wc", b_wc }, { "xgrep", b_xgrep }, - { NULL, (int (*)(int, char **, void *))NULL } + { NULL, (int (*)(int, char **, void *))NULL } }; static inline |