diff options
| author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-03-26 12:09:43 +0000 |
|---|---|---|
| committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2018-03-26 12:09:43 +0000 |
| commit | 85bd3618f496fbfcb9bec6b953b1dd7b26e318ed (patch) | |
| tree | c11030b178feafecaedb2532679f1926d8f438fd | |
| parent | 17f15d36c74db52a0de7ea5b7a1a5376ae61ddcd (diff) | |
| parent | 3718f283515535a82b83e368bda0af10d2bf2c4f (diff) | |
| download | illumos-joyent-85bd3618f496fbfcb9bec6b953b1dd7b26e318ed.tar.gz | |
[illumos-gate merge]
commit 3718f283515535a82b83e368bda0af10d2bf2c4f
9316 ldap: comparison between pointer and zero character constant
commit b232a94496f2b078a464fd9a44bc01d2f2894e78
9315 ldap: this statement may fall through
commit f45bbb216955f393ea71539b44815a06ed8fc19e
9313 cmd/fs.d: this statement may fall through
commit 5ae1545d344be9f4850975114f27a93364c65969
9311 ufs/mount: comparison between pointer and zero character constant
commit f5aec9463bdc4209d1ea6ef806601aa374b3cfc8
9310 smbstat: this statement may fall through
commit c2b69dec36507b9e29407d1fcc61adc12e08492b
9304 ftp: this statement may fall through
commit b2cf51950f94dd7f59fa3a283f96a19a31858b25
9303 chat: this statement may fall through
commit e8f5b7dfac8c9ba83bf59912c6255d201326726f
9302 dhcpagent: this statement may fall through
commit 2dfb867586bd1d3168e074ad1c8722bba53290e3
9300 in.mpathd: this statement may fall through
commit 1e6524b527749a1dddf1eec05d9d22b0234cae6c
9299 ilbd: comparison between pointer and zero character constant
commit c1a6e54c47eeacae6f9c3fe84571981c20f6d36c
9298 inetadm: this statement may fall through
commit bda17ea5bfa19b1156570d93d7f66218b2c16cec
9297 in.telnetd: comparison between pointer and zero character constant
commit 0fddcadb136a162fa3446317158d6f506f0587f3
9296 ipsecutils: this statement may fall through
commit f13c98b88c56dc9f2501130dd749358863c0e4e9
9295 ifconfig: this statement may fall through
commit f7819bf90ea3a779850c4502438d2b0e519b7941
9294 ipqosconf: comparison between pointer and zero character constant
commit 09a9b1ac03f3a1420c001044913223aa0292c882
9292 snoop: this statement may fall through
commit 243bebc0df1221801f517d667fdace1c1aeb94c1
9269 uts/i86pc: rootnex comparison between pointer and zero character constant
commit 23274804946ea79b54ae682df4d33bbbb30b42ee
8758 loader: boot1.efi needs versioning
35 files changed, 144 insertions, 154 deletions
diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/multiboot.S b/usr/src/boot/sys/boot/common/multiboot.S index 55a190e411..391ccd76c3 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/multiboot.S +++ b/usr/src/boot/sys/boot/common/multiboot.S @@ -10,18 +10,22 @@ */ /* - * Copyright 2015 Toomas Soome <tsoome@me.com> + * Copyright 2018 Toomas Soome <tsoome@me.com> */ .file "multiboot.s" /* * Provide fake multiboot header to support versioning and partition - * start. + * start. The fake MB header is used by versioning code located in + * usr/src/cmd/boot/common. Since the BIOS bootblock is stored on raw disk, + * this fake header is used to store the location of the version info block. + * Additionally we use it to store partition start_sector, so we can identify + * our root file system partition. Note we are using LBA64 here. */ #define ASM_FILE -#include <multiboot.h> +#include <sys/multiboot.h> .globl mb_header, start_sector .text diff --git a/usr/src/boot/sys/boot/efi/boot1/Makefile b/usr/src/boot/sys/boot/efi/boot1/Makefile index 49960d53c2..aee4ba24fb 100644 --- a/usr/src/boot/sys/boot/efi/boot1/Makefile +++ b/usr/src/boot/sys/boot/efi/boot1/Makefile @@ -26,8 +26,10 @@ PROG= boot1.sym MACHINE=$(MACH64) # architecture-specific loader code -SRCS= boot1.c self_reloc.c start.S ufs_module.c zfs_module.c devopen.c -OBJS= boot1.o self_reloc.o start.o ufs_module.o zfs_module.o devopen.o +SRCS= multiboot.S boot1.c self_reloc.c start.S ufs_module.c zfs_module.c \ + devopen.c +OBJS= multiboot.o boot1.o self_reloc.o start.o ufs_module.o zfs_module.o \ + devopen.o ASFLAGS=-m64 -fPIC CFLAGS= -O2 @@ -91,6 +93,7 @@ boot1.efi: ${PROG} -j .dynamic -j .dynsym -j .rel.dyn \ -j .rela.dyn -j .reloc -j .eh_frame \ --output-target=${EFI_TARGET} --subsystem efi-app ${PROG} $@ + $(BTXLD) -V ${BOOT_VERSION} -o $@ $@ boot1.o: ./../../common/ufsread.c @@ -120,6 +123,9 @@ clean clobber: %.o: ../loader/%.c $(COMPILE.c) $< +%.o: ../../common/%.S + $(COMPILE.S) $< + %.o: ../../common/%.c $(COMPILE.c) $< diff --git a/usr/src/boot/sys/boot/efi/boot1/boot1.c b/usr/src/boot/sys/boot/efi/boot1/boot1.c index 98fd3b00ff..9c3e11263f 100644 --- a/usr/src/boot/sys/boot/efi/boot1/boot1.c +++ b/usr/src/boot/sys/boot/efi/boot1/boot1.c @@ -456,9 +456,11 @@ static EFI_STATUS probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) { dev_info_t *devinfo; - EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath; + EFI_BLOCK_IO *blkio = NULL; + EFI_DEVICE_PATH *devpath, *dp; + HARDDRIVE_DEVICE_PATH *hd; EFI_STATUS status; + extern UINT64 start_sector; /* from multiboot.S */ UINTN i; /* Figure out if we're dealing with an actual partition. */ @@ -489,6 +491,23 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) *preferred = device_paths_match(imgpath, devpath); + /* + * This is the boot device. Check for the start of the partition. + * If it does not match what is specified in the stage1 loader then + * this is not our preferred device. + */ + if (*preferred == TRUE && start_sector != 0) { + dp = devpath_last(devpath); + + if (dp != NULL && + dp->Type == MEDIA_DEVICE_PATH && + dp->SubType == MEDIA_HARDDRIVE_DP) { + hd = (HARDDRIVE_DEVICE_PATH *)dp; + if (hd->PartitionStart != start_sector) + *preferred = FALSE; + } + } + /* Run through each module, see if it can load this partition */ for (i = 0; i < NUM_BOOT_MODULES; i++) { if ((status = BS->AllocatePool(EfiLoaderData, diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile index f492bf20fd..0a8793a0d8 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/Makefile @@ -52,7 +52,6 @@ CFLAGS= -nostdinc -DBOOTPROG=\"gptzfsboot\" \ -I../../../cddl/boot/zfs \ -I../btx/lib -I. \ -I../../.. \ - -I../../../sys \ -I../libi386 \ -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \ -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \ @@ -135,6 +134,9 @@ devicename.o: ../libi386/devicename.c time.o: ../libi386/time.c $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c +multiboot.o: ../../common/multiboot.S + $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ ../../common/$*.S + .S.o: $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $< diff --git a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c index cc161b564e..623114d1ae 100644 --- a/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c +++ b/usr/src/boot/sys/boot/i386/gptzfsboot/zfsboot.c @@ -23,7 +23,7 @@ #include <sys/disk.h> #include <sys/reboot.h> #include <sys/queue.h> -#include <multiboot.h> +#include <sys/multiboot.h> #include <machine/bootinfo.h> #include <machine/elf.h> diff --git a/usr/src/boot/sys/boot/i386/libi386/multiboot.c b/usr/src/boot/sys/boot/i386/libi386/multiboot.c index f169f73902..3ab8905352 100644 --- a/usr/src/boot/sys/boot/i386/libi386/multiboot.c +++ b/usr/src/boot/sys/boot/i386/libi386/multiboot.c @@ -49,7 +49,7 @@ #include <stand.h> #include "bootstrap.h" -#include "multiboot.h" +#include <sys/multiboot.h> #include "../zfs/libzfs.h" #include "../i386/libi386/libi386.h" #include "../i386/btx/lib/btxv86.h" diff --git a/usr/src/boot/sys/boot/i386/libi386/multiboot.h b/usr/src/boot/sys/sys/multiboot.h index 819fa2e501..819fa2e501 100644 --- a/usr/src/boot/sys/boot/i386/libi386/multiboot.h +++ b/usr/src/boot/sys/sys/multiboot.h diff --git a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c index 812bb8e414..e7c479f133 100644 --- a/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c +++ b/usr/src/cmd/cmd-inet/sbin/dhcpagent/agent.c @@ -1010,15 +1010,13 @@ load_option: * going into SELECTING. */ - if (debug_level == 0 && set_start_timer(dsmp)) { - /* next destination: dhcp_start() */ - break; - } else { + if (debug_level != 0 || !set_start_timer(dsmp)) { dhcp_selecting(dsmp); /* next destination: dhcp_requesting() */ - break; } + /* else next destination: dhcp_start() */ } + break; case DHCP_STATUS: { dhcp_status_t status; diff --git a/usr/src/cmd/cmd-inet/usr.bin/chat/chat.c b/usr/src/cmd/cmd-inet/usr.bin/chat/chat.c index 6954ed7a25..bed933f162 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/chat/chat.c +++ b/usr/src/cmd/cmd-inet/usr.bin/chat/chat.c @@ -1206,6 +1206,7 @@ int get_char() default: logf("warning: read() on stdin returned %d", status); + /* FALLTHROUGH */ case -1: if ((status = fcntl(0, F_GETFL, 0)) == -1) @@ -1231,17 +1232,18 @@ int c; switch (status) { case 1: return (0); - + default: logf("warning: write() on stdout returned %d", status); - + /* FALLTHROUGH */ + case -1: if ((status = fcntl(0, F_GETFL, 0)) == -1) fatal(2, "Can't get file mode flags on stdin, %m"); if (fcntl(0, F_SETFL, status & ~O_NONBLOCK) == -1) fatal(2, "Can't set file mode flags on stdin: %m"); - + return (-1); } } diff --git a/usr/src/cmd/cmd-inet/usr.bin/ftp/cmds.c b/usr/src/cmd/cmd-inet/usr.bin/ftp/cmds.c index 4be0e5d371..1b2fc48680 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/ftp/cmds.c +++ b/usr/src/cmd/cmd-inet/usr.bin/ftp/cmds.c @@ -36,9 +36,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - - /* * FTP User Program -- Command Routines. */ @@ -1941,7 +1938,7 @@ domap(char *name) cp2 += len2; /* Consume wide char */ break; } - /* intentional drop through */ + /* FALLTHROUGH */ default: if (wc2 != wc1) match = 0; @@ -2074,7 +2071,7 @@ LOOP: cp2++; break; } - /* intentional drop through */ + /* FALLTHROUGH */ default: if ((len2 = mblen(cp2, MB_CUR_MAX)) <= 0) len2 = 1; diff --git a/usr/src/cmd/cmd-inet/usr.bin/ftp/domacro.c b/usr/src/cmd/cmd-inet/usr.bin/ftp/domacro.c index 2d8421bbb3..e4a0d6a4c3 100644 --- a/usr/src/cmd/cmd-inet/usr.bin/ftp/domacro.c +++ b/usr/src/cmd/cmd-inet/usr.bin/ftp/domacro.c @@ -37,8 +37,6 @@ * contributors. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <libintl.h> #include <stdlib.h> @@ -123,7 +121,7 @@ TOP: } break; } - /* intentional drop through */ + /* FALLTHROUGH */ default: if ((len = mblen(cp1, MB_CUR_MAX)) <= 0) len = 1; diff --git a/usr/src/cmd/cmd-inet/usr.lib/ilbd/ilbd_rules.c b/usr/src/cmd/cmd-inet/usr.lib/ilbd/ilbd_rules.c index 3af2ff3a68..63adcf3dd9 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/ilbd/ilbd_rules.c +++ b/usr/src/cmd/cmd-inet/usr.lib/ilbd/ilbd_rules.c @@ -839,7 +839,7 @@ i_ilbd_rule_action(const char *rule_name, const struct passwd *ps, rc = ilbd_check_client_config_auth(ps); /* generate the audit record before bailing out */ if (rc != ILB_STATUS_OK) { - if (rule_name != '\0') { + if (*rule_name != '\0') { ilbd_audit_rule_event(rule_name, NULL, cmd, rc, ucredp); } else { diff --git a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c index c0621996d3..dbae74bbab 100644 --- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c +++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_main.c @@ -2332,6 +2332,7 @@ loopback_cmd(int sock, int family) (void) close(newfd); return; } + break; default: logdebug("loopback_cmd: family %d\n", family); diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c index 481bc621d4..9da0ed811f 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/ifconfig/ifconfig.c @@ -213,6 +213,7 @@ static dladm_status_t ifconfig_dladm_open(const char *, datalink_class_t, static void dladmerr_exit(dladm_status_t status, const char *str); static void ipadmerr_exit(ipadm_status_t status, const char *str); static boolean_t ifconfig_use_libipadm(int, const char *); +void Perror0_exit(const char *cmd) __NORETURN; #define max(a, b) ((a) < (b) ? (b) : (a)) diff --git a/usr/src/cmd/cmd-inet/usr.sbin/in.telnetd.c b/usr/src/cmd/cmd-inet/usr.sbin/in.telnetd.c index 896b46eb2b..181e6cbabe 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/in.telnetd.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/in.telnetd.c @@ -3046,7 +3046,7 @@ doit(int f, struct sockaddr_storage *who) * Show banner that getty never gave, but * only if the user did not automatically authenticate. */ - if (getenv("USER") == '\0' && auth_status < AUTH_USER) + if (getenv("USER") == NULL && auth_status < AUTH_USER) showbanner(); /* diff --git a/usr/src/cmd/cmd-inet/usr.sbin/inetadm/inetadm.c b/usr/src/cmd/cmd-inet/usr.sbin/inetadm/inetadm.c index d0e96f81b7..66ecf99d37 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/inetadm/inetadm.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/inetadm/inetadm.c @@ -24,8 +24,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * inetadm - administer services controlled by inetd and print out inetd * service related information. @@ -1026,6 +1024,7 @@ main(int argc, char *argv[]) } else { usage(B_FALSE); } + break; default: usage(B_FALSE); } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ipqosconf/ipqosconf.c b/usr/src/cmd/cmd-inet/usr.sbin/ipqosconf/ipqosconf.c index 975adc4a7b..dc7327158a 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/ipqosconf/ipqosconf.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/ipqosconf/ipqosconf.c @@ -4823,7 +4823,7 @@ char **token) /* Skip any whitespace */ - while (isspace(*st) && st != '\0') { + while (isspace(*st) && *st != '\0') { st++; } diff --git a/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikeadm.c b/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikeadm.c index 023b9006fc..60f3ed937c 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikeadm.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/ipsecutils/ikeadm.c @@ -79,6 +79,9 @@ CPL_MATCH_FN(no_match) return (0); } +static void command_complete(int s) __NORETURN; +static void usage(void) __NORETURN; + static void command_complete(int s) { @@ -90,7 +93,7 @@ command_complete(int s) } static void -usage() +usage(void) { if (!interactive) { (void) fprintf(stderr, gettext("Usage:\t" @@ -810,7 +813,7 @@ parse_cky(int argc, char **argv, uint64_t *ckyp) static int parse_addr_pr(int argc, char **argv, struct hostent **h1pp, - struct hostent **h2pp) + struct hostent **h2pp) { int rtn, consumed = 0; diff --git a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c index a78c418ac2..ae5ff306b7 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c +++ b/usr/src/cmd/cmd-inet/usr.sbin/snoop/snoop_nis.c @@ -24,8 +24,6 @@ * All rights reserved. */ -#ident "%Z%%M% %I% %E% SMI" /* SunOS */ - #include <sys/types.h> #include <sys/errno.h> #include <setjmp.h> @@ -123,10 +121,8 @@ static char *procnames_long[] = { }; void -interpret_nisbind(flags, type, xid, vers, proc, data, len) - int flags, type, xid, vers, proc; - char *data; - int len; +interpret_nisbind(int flags, int type, int xid, int vers, int proc, char *data, + int len) { char *line; char buff[YPMAXDOMAIN + 1]; @@ -143,20 +139,19 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) line = get_sum_line(); if (type == CALL) { - (void) sprintf(line, - "NISBIND C %s", - procnames_bind_short[proc]); + (void) sprintf(line, "NISBIND C %s", + procnames_bind_short[proc]); line += strlen(line); switch (proc) { case YPBINDPROC_NULL: break; case YPBINDPROC_DOMAIN: (void) sprintf(line, " %s", - getxdr_string(buff, YPMAXDOMAIN)); + getxdr_string(buff, YPMAXDOMAIN)); break; case YPBINDPROC_SETDOM: (void) sprintf(line, " %s", - getxdr_string(buff, YPMAXDOMAIN)); + getxdr_string(buff, YPMAXDOMAIN)); break; default: break; @@ -164,7 +159,7 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) check_retransmit(line, xid); } else { (void) sprintf(line, "NISBIND R %s ", - procnames_bind_short[proc]); + procnames_bind_short[proc]); line += strlen(line); switch (proc) { case YPBINDPROC_NULL: @@ -176,7 +171,7 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) } else { /* failure */ status = getxdr_long(); (void) sprintf(line, "ERROR=%s", - ypbind_error(status)); + ypbind_error(status)); } break; case YPBINDPROC_SETDOM: @@ -189,25 +184,24 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) if (flags & F_DTAIL) { show_header("NISBIND:", - "Network Information Service Bind", len); + "Network Information Service Bind", len); show_space(); if (setjmp(xdr_err)) { return; } - (void) sprintf(get_line(0, 0), - "Proc = %d (%s)", - proc, procnames_bind_long[proc]); + (void) sprintf(get_line(0, 0), "Proc = %d (%s)", + proc, procnames_bind_long[proc]); if (type == CALL) { switch (proc) { case YPBINDPROC_NULL: break; case YPBINDPROC_DOMAIN: (void) showxdr_string(YPMAXDOMAIN, - "Domain = %s"); + "Domain = %s"); break; case YPBINDPROC_SETDOM: (void) showxdr_string(YPMAXDOMAIN, - "Domain = %s"); + "Domain = %s"); (void) showxdr_hex(4, "Address=%s"); (void) showxdr_hex(2, "Port=%s"); (void) showxdr_u_long("Version=%lu"); @@ -222,20 +216,17 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) case YPBINDPROC_DOMAIN: status = getxdr_u_long(); (void) sprintf(get_line(0, 0), - "Status = %lu (%s)", - status, - status == 1 ? "OK":"Fail"); + "Status = %lu (%s)", + status, + status == 1 ? "OK":"Fail"); if (status == 1) { - (void) showxdr_hex(4, - "Address=%s"); - (void) showxdr_hex(2, - "Port=%s"); + (void) showxdr_hex(4, "Address=%s"); + (void) showxdr_hex(2, "Port=%s"); } else { status = getxdr_u_long(); (void) sprintf(get_line(0, 0), - "Error = %lu (%s)", - status, - ypbind_error(status)); + "Error = %lu (%s)", status, + ypbind_error(status)); } break; case YPBINDPROC_SETDOM: @@ -249,10 +240,8 @@ interpret_nisbind(flags, type, xid, vers, proc, data, len) } void -interpret_nis(flags, type, xid, vers, proc, data, len) - int flags, type, xid, vers, proc; - char *data; - int len; +interpret_nis(int flags, int type, int xid, int vers, int proc, char *data, + int len) { char *line; char *dom, *map, *key; @@ -272,9 +261,8 @@ interpret_nis(flags, type, xid, vers, proc, data, len) if (proc > MAXPROC) (void) sprintf(line, "NIS C %d", proc); else - (void) sprintf(line, - "NIS C %s", - procnames_short[proc]); + (void) sprintf(line, "NIS C %s", + procnames_short[proc]); line += strlen(line); switch (proc) { case YPPROC_NULL: @@ -284,7 +272,7 @@ interpret_nis(flags, type, xid, vers, proc, data, len) case YPPROC_MAPLIST: /* YPMAXDOMAIN > YPMAXMAP */ (void) sprintf(line, " %s", - getxdr_string(buff1, YPMAXDOMAIN)); + getxdr_string(buff1, YPMAXDOMAIN)); break; case YPPROC_FIRST: dom = getxdr_string(buff1, YPMAXDOMAIN); @@ -296,17 +284,13 @@ interpret_nis(flags, type, xid, vers, proc, data, len) dom = getxdr_string(buff1, YPMAXDOMAIN); map = getxdr_string(buff2, YPMAXMAP); key = getxdr_string(buff3, YPMAXRECORD); - (void) sprintf(line, - " %s in %s", - key, map); + (void) sprintf(line, " %s in %s", key, map); break; case YPPROC_NEWXFR: case YPPROC_XFR: dom = getxdr_string(buff1, YPMAXDOMAIN); map = getxdr_string(buff2, YPMAXMAP); - (void) sprintf(line, - " map %s in %s", - map, dom); + (void) sprintf(line, " map %s in %s", map, dom); break; case YPPROC_CLEAR: break; @@ -315,9 +299,7 @@ interpret_nis(flags, type, xid, vers, proc, data, len) case YPPROC_ORDER: dom = getxdr_string(buff1, YPMAXDOMAIN); map = getxdr_string(buff2, YPMAXMAP); - (void) sprintf(line, - " map %s in %s", - map, dom); + (void) sprintf(line, " map %s in %s", map, dom); break; default: break; @@ -328,7 +310,7 @@ interpret_nis(flags, type, xid, vers, proc, data, len) (void) sprintf(line, "NIS R %d ", proc); else (void) sprintf(line, "NIS R %s ", - procnames_short[proc]); + procnames_short[proc]); line += strlen(line); switch (proc) { case YPPROC_NULL: @@ -336,7 +318,7 @@ interpret_nis(flags, type, xid, vers, proc, data, len) case YPPROC_DOMAIN: case YPPROC_DOMAIN_NONACK: (void) sprintf(line, "%s", - getxdr_long() ? "OK":"Fail"); + getxdr_long() ? "OK":"Fail"); break; case YPPROC_MATCH: (void) sum_ypstat(line); @@ -346,19 +328,18 @@ interpret_nis(flags, type, xid, vers, proc, data, len) if (sum_ypstat(line) == YP_TRUE) { line += strlen(line); (void) getxdr_string(buff1, - YPMAXRECORD); + YPMAXRECORD); (void) sprintf(line, " key=%s", - getxdr_string(buff1, - YPMAXRECORD)); + getxdr_string(buff1, + YPMAXRECORD)); } break; case YPPROC_NEWXFR: case YPPROC_XFR: transid = getxdr_u_long(); status = getxdr_long(); - (void) sprintf(line, "transid=%lu %s", - transid, - sum_ypxfrstat(status)); + (void) sprintf(line, "transid=%lu %s", transid, + sum_ypxfrstat(status)); break; case YPPROC_CLEAR: break; @@ -369,30 +350,28 @@ interpret_nis(flags, type, xid, vers, proc, data, len) (void) sprintf(line, " key=%s", getxdr_string(buff1, YPMAXRECORD)); } else { - (void) sprintf(line, - "No more"); + (void) sprintf(line, "No more"); } break; case YPPROC_MASTER: if (sum_ypstat(line) == YP_TRUE) { line += strlen(line); (void) sprintf(line, " peer=%s", - getxdr_string(buff1, - YPMAXPEER)); + getxdr_string(buff1, YPMAXPEER)); } break; case YPPROC_ORDER: if (sum_ypstat(line) == YP_TRUE) { line += strlen(line); (void) sprintf(line, " order=%lu", - getxdr_u_long()); + getxdr_u_long()); } break; case YPPROC_MAPLIST: if (sum_ypstat(line) == YP_TRUE) { line += strlen(line); (void) sprintf(line, " %s", - sum_ypmaplist()); + sum_ypmaplist()); } break; default: @@ -407,10 +386,8 @@ interpret_nis(flags, type, xid, vers, proc, data, len) if (setjmp(xdr_err)) { return; } - (void) sprintf(get_line(0, 0), - "Proc = %d (%s)", - proc, - proc > MAXPROC ? "unknown" : procnames_long[proc]); + (void) sprintf(get_line(0, 0), "Proc = %d (%s)", proc, + proc > MAXPROC ? "unknown" : procnames_long[proc]); if (type == CALL) niscall(proc); else @@ -424,8 +401,7 @@ interpret_nis(flags, type, xid, vers, proc, data, len) */ static void -niscall(proc) - int proc; +niscall(int proc) { switch (proc) { case YPPROC_NULL: @@ -481,8 +457,7 @@ niscall(proc) */ void -nisreply(proc) - int proc; +nisreply(int proc) { unsigned int xfrstat, more; @@ -491,9 +466,8 @@ nisreply(proc) break; case YPPROC_DOMAIN: case YPPROC_DOMAIN_NONACK: - (void) sprintf(get_line(0, 0), - "Result=%s", - getxdr_u_long() ? "OK":"Fail"); + (void) sprintf(get_line(0, 0), "Result=%s", + getxdr_u_long() ? "OK":"Fail"); break; case YPPROC_MATCH: (void) detail_ypstat(); @@ -509,17 +483,15 @@ nisreply(proc) case YPPROC_XFR: (void) showxdr_u_long("Transid = %lu"); xfrstat = getxdr_u_long(); - (void) sprintf(get_line(0, 0), - "Transfer status = %lu (%s)", - xfrstat, sum_ypxfrstat(xfrstat)); + (void) sprintf(get_line(0, 0), "Transfer status = %lu (%s)", + xfrstat, sum_ypxfrstat(xfrstat)); break; case YPPROC_CLEAR: break; case YPPROC_ALL: more = getxdr_u_long(); - (void) sprintf(get_line(0, 0), - "More = %s", - more ? "true" : "false"); + (void) sprintf(get_line(0, 0), "More = %s", + more ? "true" : "false"); if (more) { (void) detail_ypstat(); (void) showxdr_string(YPMAXRECORD, "Value = %s"); @@ -529,6 +501,7 @@ nisreply(proc) case YPPROC_MASTER: (void) detail_ypstat(); (void) showxdr_string(YPMAXPEER, "Peer = %s"); + break; case YPPROC_ORDER: (void) detail_ypstat(); (void) showxdr_u_long("Order=%lu"); @@ -543,8 +516,7 @@ nisreply(proc) } char * -sum_ypxfrstat(status) - int status; +sum_ypxfrstat(int status) { static char buff [16]; @@ -573,8 +545,7 @@ sum_ypxfrstat(status) } static int -sum_ypstat(line) - char *line; +sum_ypstat(char *line) { ulong_t status; char *str; @@ -602,22 +573,20 @@ sum_ypstat(line) } static int -detail_ypstat() +detail_ypstat(void) { ulong_t status; char buff[32]; status = sum_ypstat(buff); - (void) sprintf(get_line(0, 0), - "Status = %d (%s)", - status, buff); + (void) sprintf(get_line(0, 0), "Status = %d (%s)", status, buff); return ((int)status); } char * -sum_ypmaplist() +sum_ypmaplist(void) { static char buff[YPMAXMAP + 1]; int maps = 0; @@ -637,14 +606,13 @@ sum_ypmaplist() } void -detail_ypmaplist() +detail_ypmaplist(void) { int maps = 0; if (setjmp(xdr_err)) { (void) sprintf(get_line(0, 0), - " %d+ maps. (Frame is incomplete)", - maps); + " %d+ maps. (Frame is incomplete)", maps); return; } @@ -659,8 +627,7 @@ detail_ypmaplist() } char * -ypbind_error(err) - int err; +ypbind_error(int err) { static char buff[16]; diff --git a/usr/src/cmd/fs.d/autofs/autod_nfs.c b/usr/src/cmd/fs.d/autofs/autod_nfs.c index fb6ab8643c..76cdcc77e2 100644 --- a/usr/src/cmd/fs.d/autofs/autod_nfs.c +++ b/usr/src/cmd/fs.d/autofs/autod_nfs.c @@ -4259,6 +4259,7 @@ get_netconfig_info(enum type_of_stuff type_of_stuff, char *hostname, break; case SERVER_PING: ping_server = 1; + /* FALLTHROUGH */ case SERVER_ADDR: nb = get_server_addrorping(hostname, prog, vers, nconf, port, tinfo, tbind, fhp, direct_to_server, diff --git a/usr/src/cmd/fs.d/ff.c b/usr/src/cmd/fs.d/ff.c index df6fcb8ba8..e11b072371 100644 --- a/usr/src/cmd/fs.d/ff.c +++ b/usr/src/cmd/fs.d/ff.c @@ -28,9 +28,8 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> +#include <stdlib.h> #include <limits.h> #include <string.h> #include <sys/fstyp.h> diff --git a/usr/src/cmd/fs.d/hsfs/labelit/labelit.c b/usr/src/cmd/fs.d/hsfs/labelit/labelit.c index 1eaaa0ef48..78e089c9f6 100644 --- a/usr/src/cmd/fs.d/hsfs/labelit/labelit.c +++ b/usr/src/cmd/fs.d/hsfs/labelit/labelit.c @@ -334,6 +334,7 @@ updatelabel(void) * after update unix volume descriptor, * fall thru to update the iso primary vol descriptor */ + /* FALLTHROUGH */ case 1: copystring(sysid, (char *)ISO_sys_id(iso_buf), 32); copystring(volid, (char *)ISO_vol_id(iso_buf), 32); diff --git a/usr/src/cmd/fs.d/smbclnt/smbutil/smbutil.c b/usr/src/cmd/fs.d/smbclnt/smbutil/smbutil.c index 404b436d16..20cb3a2c86 100644 --- a/usr/src/cmd/fs.d/smbclnt/smbutil/smbutil.c +++ b/usr/src/cmd/fs.d/smbclnt/smbutil/smbutil.c @@ -54,8 +54,7 @@ #define EX_DATAERR 1 #endif -static void help(void); - +static void help(void) __NORETURN; typedef int cmd_fn_t (int argc, char *argv[]); typedef void cmd_usage_t (void); diff --git a/usr/src/cmd/fs.d/udfs/fsck/pass1.c b/usr/src/cmd/fs.d/udfs/fsck/pass1.c index 3d18f53958..fad597b719 100644 --- a/usr/src/cmd/fs.d/udfs/fsck/pass1.c +++ b/usr/src/cmd/fs.d/udfs/fsck/pass1.c @@ -25,8 +25,6 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <strings.h> #include <malloc.h> @@ -168,6 +166,7 @@ pass1() case FTYPE_FILE: case FTYPE_SYMLINK: ckinode(fp); + /* FALLTHROUGH */ default: n_files++; break; diff --git a/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c b/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c index bdabf28435..17ea9f99f2 100644 --- a/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c +++ b/usr/src/cmd/fs.d/ufs/fsdb/fsdb.c @@ -25,12 +25,6 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */ -#ifndef lint -char copyright[] = -"@(#) Copyright(c) 1988 Regents of the University of California.\n\ -All rights reserved.\n"; -#endif /* not lint */ - /* * fsdb - file system debugger * @@ -323,7 +317,7 @@ static void print(long value, int fieldsz, int digits, int lead); static void printsb(struct fs *); static void printcg(struct cg *); static void pbits(unsigned char *, int); -static void old_fsdb(int, char *); /* For old fsdb functionality */ +static void old_fsdb(int, char *) __NORETURN; /* For old fsdb functionality */ static int isnumber(char *); static int icheck(u_offset_t); diff --git a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c index a3464f9b5c..7cf5e1c5a0 100644 --- a/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c +++ b/usr/src/cmd/fs.d/ufs/mkfs/mkfs.c @@ -403,7 +403,7 @@ static void wtfs_breakup(diskaddr_t bno, int size, char *bf); static int isblock(struct fs *fs, unsigned char *cp, int h); static void clrblock(struct fs *fs, unsigned char *cp, int h); static void setblock(struct fs *fs, unsigned char *cp, int h); -static void usage(); +static void usage(void) __NORETURN; static void dump_fscmd(char *fsys, int fsi); static uint64_t number(uint64_t d_value, char *param, int flags); static int match(char *s); @@ -572,7 +572,7 @@ diskaddr_t testfrags; int inlockexit; int isbad; -void lockexit(int); +void lockexit(int) __NORETURN; void randomgeneration(void); void checksummarysize(void); int checksblock(struct fs, int); @@ -3452,7 +3452,7 @@ setblock(struct fs *fs, unsigned char *cp, int h) } static void -usage() +usage(void) { (void) fprintf(stderr, gettext("ufs usage: mkfs [-F FSType] [-V] [-m] [-o options] " diff --git a/usr/src/cmd/fs.d/ufs/mount/mount.c b/usr/src/cmd/fs.d/ufs/mount/mount.c index 9a433ab1c0..38d44db746 100644 --- a/usr/src/cmd/fs.d/ufs/mount/mount.c +++ b/usr/src/cmd/fs.d/ufs/mount/mount.c @@ -533,7 +533,7 @@ mountfs(struct mnttab *mnt) */ if (gflg || findopt(mnt->mnt_mntopts, MNTOPT_GLOBAL)) { if (!(flags & MS_RDONLY)) { - if (mnt->mnt_mntopts != '\0') + if (mnt->mnt_mntopts[0] != '\0') (void) strcat(mnt->mnt_mntopts, ","); (void) strcat(mnt->mnt_mntopts, MNTOPT_LOGGING); args.flags |= UFSMNT_LOGGING; @@ -542,7 +542,7 @@ mountfs(struct mnttab *mnt) * Turn off logging for read only global mounts. * It was set to logging as default above. */ - if (mnt->mnt_mntopts != '\0') + if (mnt->mnt_mntopts[0] != '\0') (void) strcat(mnt->mnt_mntopts, ","); (void) strcat(mnt->mnt_mntopts, MNTOPT_NOLOGGING); args.flags &= ~UFSMNT_LOGGING; diff --git a/usr/src/cmd/fs.d/ufs/newfs/newfs.c b/usr/src/cmd/fs.d/ufs/newfs/newfs.c index 8c2f198aef..877c31a30d 100644 --- a/usr/src/cmd/fs.d/ufs/newfs/newfs.c +++ b/usr/src/cmd/fs.d/ufs/newfs/newfs.c @@ -64,7 +64,7 @@ static int validate_size(char *disk, diskaddr_t size); static void exenv(void); static struct fs *read_sb(char *); /*PRINTFLIKE1*/ -static void fatal(char *fmt, ...); +static void fatal(char *fmt, ...) __NORETURN; #define EPATH "PATH=/usr/sbin:/sbin:" #define CPATH "/sbin" /* an EPATH element */ diff --git a/usr/src/cmd/ldap/common/common.c b/usr/src/cmd/ldap/common/common.c index dafdbb238f..169b472eba 100644 --- a/usr/src/cmd/ldap/common/common.c +++ b/usr/src/cmd/ldap/common/common.c @@ -647,8 +647,8 @@ ldaptool_process_args( int argc, char **argv, char *extra_opts, break; case 'y': /* old (version 1) proxied authorization control */ proxyauth_version = 1; + /* FALLTHROUGH */ case 'Y': /* new (version 2 ) proxied authorization control */ - /*FALLTHRU*/ proxyauth_id = strdup(optarg); if (NULL == proxyauth_id) { diff --git a/usr/src/cmd/ldap/common/ldapsearch.c b/usr/src/cmd/ldap/common/ldapsearch.c index 277be6e3ef..2160f13ece 100644 --- a/usr/src/cmd/ldap/common/ldapsearch.c +++ b/usr/src/cmd/ldap/common/ldapsearch.c @@ -240,7 +240,7 @@ main( int argc, char **argv ) if ( argv[ optind ] == NULL ) { attrs = NULL; - } else if ( sortattr == NULL || *sortattr == '\0' || server_sort) { + } else if ( sortattr == NULL || *sortattr == NULL || server_sort) { attrs = &argv[ optind ]; } else { attrs = ldap_charray_dup( &argv[ optind ] ); diff --git a/usr/src/cmd/ldap/ns_ldap/ldapaddent.c b/usr/src/cmd/ldap/ns_ldap/ldapaddent.c index 62c028c481..e4a645636a 100644 --- a/usr/src/cmd/ldap/ns_ldap/ldapaddent.c +++ b/usr/src/cmd/ldap/ns_ldap/ldapaddent.c @@ -109,7 +109,7 @@ ascii_to_int(char *str) if (c == NULL || *c == '\0') return (-1); - while (c != '\0' && *c == ' ') + while (*c == ' ') c++; if (*c == '\0') return (-1); @@ -2097,7 +2097,7 @@ genent_aliases(char *line, int (*cback)()) } t[0] = '\0'; - if (++t == '\0') { + if ((++t)[0] == '\0') { (void) strlcpy(parse_err_msg, gettext("no alias value"), PARSE_ERR_MSG_LEN); return (GENENT_PARSEERR); diff --git a/usr/src/cmd/ldap/ns_ldap/ldapclient.c b/usr/src/cmd/ldap/ns_ldap/ldapclient.c index 937172feb2..c36401f35e 100644 --- a/usr/src/cmd/ldap/ns_ldap/ldapclient.c +++ b/usr/src/cmd/ldap/ns_ldap/ldapclient.c @@ -2523,7 +2523,7 @@ adminCredCheck(clientopts_t *arglist) } /* Now let's check if we have the cred stuff we need */ - if (adminDN == NULL || adminDN[0] == '\0') { + if (adminDN == NULL || adminDN[0] == NULL) { CLIENT_FPUTS( gettext("Shadow Update is enabled, but " "no adminDN is configured.\n"), stderr); @@ -2532,7 +2532,7 @@ adminCredCheck(clientopts_t *arglist) } /* If we need adminPassword (prompt) */ - if (adminPassword == NULL || adminPassword[0] == '\0') { + if (adminPassword == NULL || adminPassword[0] == NULL) { CLIENT_FPUTS( gettext("Shadow Update requires adminPassword\n"), stderr); diff --git a/usr/src/cmd/smbsrv/smbstat/smbstat.c b/usr/src/cmd/smbsrv/smbstat/smbstat.c index c8ea26d7f9..9982ddfad0 100644 --- a/usr/src/cmd/smbsrv/smbstat/smbstat.c +++ b/usr/src/cmd/smbsrv/smbstat/smbstat.c @@ -263,7 +263,7 @@ static void *smbstat_zalloc(size_t); static void smbstat_free(void *, size_t); static void smbstat_fail(int, char *, ...); static void smbstat_snapshot_inc_idx(void); -static void smbstat_usage(FILE *, int); +static void smbstat_usage(FILE *, int) __NORETURN; static uint_t smbstat_strtoi(char const *, char *); static double smbstat_hrtime_delta(hrtime_t, hrtime_t); static double smbstat_sub_64(uint64_t, uint64_t); diff --git a/usr/src/uts/i86pc/io/immu.c b/usr/src/uts/i86pc/io/immu.c index 8bad3acd72..5c9f723e65 100644 --- a/usr/src/uts/i86pc/io/immu.c +++ b/usr/src/uts/i86pc/io/immu.c @@ -691,9 +691,9 @@ blacklisted_smbios(void) strptr = &black_array[i]; if (strcmp(*strptr++, "SMBIOS") == 0) { if (strcmp(*strptr++, mfg) == 0 && - ((char *)strptr == '\0' || + (*strptr[0] == '\0' || strcmp(*strptr++, product) == 0) && - ((char *)strptr == '\0' || + (*strptr[0] == '\0' || strcmp(*strptr++, version) == 0)) { return (B_TRUE); } diff --git a/usr/src/uts/i86pc/io/immu_dmar.c b/usr/src/uts/i86pc/io/immu_dmar.c index 7ebcfb0ba6..384f16e554 100644 --- a/usr/src/uts/i86pc/io/immu_dmar.c +++ b/usr/src/uts/i86pc/io/immu_dmar.c @@ -926,9 +926,9 @@ immu_dmar_blacklisted(char **strptr, uint_t nstrs) for (i = 0; nstrs - i >= 4; i++) { if (strcmp(*strptr++, "DMAR") == 0) { if (strcmp(*strptr++, tbl->tbl_oem_id) == 0 && - ((char *)strptr == '\0' || + (*strptr[0] == '\0' || strcmp(*strptr++, tbl->tbl_oem_tblid) == 0) && - ((char *)strptr == '\0' || + (*strptr[0] == '\0' || strcmp(*strptr++, oem_rev) == 0)) { return (B_TRUE); } |
