summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Levon <john.levon@joyent.com>2019-08-22 14:13:57 +0000
committerJohn Levon <john.levon@joyent.com>2019-08-22 14:15:41 +0000
commit4ad9cc07d7a3af5dbe729bd2da31e2919a64a691 (patch)
tree24d511622fb7f703caf3d5f9e7b476b5b39daa1c
parent2eeb06d4319586a0633839bcb1704f78fd2b1977 (diff)
downloadillumos-joyent-4ad9cc07d7a3af5dbe729bd2da31e2919a64a691.tar.gz
10703 smatch unreachable code checking needs reworking (fix Joyent code)
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com> Approved by: Jerry Jelinek <jerry.jelinek@joyent.com>
-rw-r--r--usr/src/cmd/logadm/Makefile2
-rw-r--r--usr/src/cmd/logadm/conf.c5
-rw-r--r--usr/src/cmd/logadm/glob.c6
-rw-r--r--usr/src/cmd/logadm/main.c24
-rw-r--r--usr/src/uts/i86pc/os/cpr_impl.c7
5 files changed, 11 insertions, 33 deletions
diff --git a/usr/src/cmd/logadm/Makefile b/usr/src/cmd/logadm/Makefile
index b9ee0560ea..7b959c0dba 100644
--- a/usr/src/cmd/logadm/Makefile
+++ b/usr/src/cmd/logadm/Makefile
@@ -20,6 +20,7 @@
#
#
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright 2019 Joyent, Inc.
#
PROG= logadm
@@ -36,6 +37,7 @@ CPPFLAGS += -D_FILE_OFFSET_BITS=64
CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-clobbered
CERRWARN += $(CNOWARN_UNINIT)
+CERRWARN += -_gcc=-Wno-unused-label
XGETFLAGS += -a -x logadm.xcl
$(ROOTETC)/$(CONFIGFILE):= FILEMODE= 644
diff --git a/usr/src/cmd/logadm/conf.c b/usr/src/cmd/logadm/conf.c
index 25bcc4f63d..93837fbebf 100644
--- a/usr/src/cmd/logadm/conf.c
+++ b/usr/src/cmd/logadm/conf.c
@@ -21,7 +21,7 @@
/*
* Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2013, Joyent, Inc. All rights reserved.
+ * Copyright 2019 Joyent, Inc.
* Copyright 2018 Sebastian Wiedenroth
*/
@@ -279,8 +279,6 @@ conf_scan(const char *fname, char *buf, int buflen, int timescan)
if (SETJMP) {
err(EF_FILE, "cannot process invalid entry %s",
entry);
- ret = 0;
- LOCAL_ERR_BREAK;
}
if (timescan) {
@@ -529,7 +527,6 @@ conf_close(struct opts *opts)
(void) unlink(tuname);
err(EF_JMP, "unsafe to update configuration file "
"or timestamps");
- return;
}
/* rename updated files into place */
diff --git a/usr/src/cmd/logadm/glob.c b/usr/src/cmd/logadm/glob.c
index 338a1c6b9f..0978c876e9 100644
--- a/usr/src/cmd/logadm/glob.c
+++ b/usr/src/cmd/logadm/glob.c
@@ -22,6 +22,8 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
+ * Copyright 2019 Joyent, Inc.
+ *
* logadm/glob.c -- globbing routines
*
* these routines support two kinds of globs. first, the
@@ -62,8 +64,6 @@
* braces, and don't support the more powerful reglobs required by logadm.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <libintl.h>
#include <stdlib.h>
@@ -100,8 +100,6 @@ glob_debrace(struct fn *fnp)
while (sp != NULL && (left = strchr(sp, '{')) != NULL)
if ((right = strchr(left, '}')) == NULL) {
err(EF_FILE|EF_JMP, "Missing }");
- fn_list_free(ret);
- return (NULL);
} else {
/* stuff before "left" is finished */
fn_list_appendrange(ret, sp, left);
diff --git a/usr/src/cmd/logadm/main.c b/usr/src/cmd/logadm/main.c
index 624397d41f..15f71be166 100644
--- a/usr/src/cmd/logadm/main.c
+++ b/usr/src/cmd/logadm/main.c
@@ -603,17 +603,14 @@ rotatelog(struct fn *fnp, struct opts *opts)
if (opts_count(opts, "N"))
return (1);
err(EF_WARN|EF_SYS, "%s", fname);
- return (B_FALSE);
}
if ((stbuf.st_mode & S_IFMT) == S_IFLNK) {
err(EF_WARN, "%s is a symlink", fname);
- return (B_FALSE);
}
if ((stbuf.st_mode & S_IFMT) != S_IFREG) {
err(EF_WARN, "%s is not a regular file", fname);
- return (B_FALSE);
}
/* even if size condition is not met, this entry is "done" */
@@ -1074,7 +1071,6 @@ docmd(struct opts *opts, const char *msg, const char *cmd,
(arg2) ? arg2 : "",
(arg3) ? " " : "",
(arg3) ? arg3 : "");
- first = B_FALSE;
}
err_fromfd(pfd.fd);
}
@@ -1084,7 +1080,6 @@ docmd(struct opts *opts, const char *msg, const char *cmd,
}
if (waitpid(pid, &wstat, 0) < 0) {
err(EF_SYS, "waitpid");
- return;
}
if (!first) {
@@ -1149,20 +1144,15 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
/* open log file to be rotated and remember its chmod mask */
if ((fi = open(file, O_RDWR)) < 0) {
err(EF_SYS, "cannot open file %s", file);
- return;
}
if (fstat(fi, &s) < 0) {
err(EF_SYS, "cannot access: %s", file);
- (void) close(fi);
- return;
}
/* create new file for copy destination with correct attributes */
if ((fo = open(file_copy, O_CREAT|O_TRUNC|O_WRONLY, s.st_mode)) < 0) {
err(EF_SYS, "cannot create file: %s", file_copy);
- (void) close(fi);
- return;
}
(void) fchown(fo, s.st_uid, s.st_gid);
@@ -1188,10 +1178,6 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
do {
if (fstat(fi, &s) < 0) {
err(EF_SYS, "cannot stat: %s", file);
- (void) close(fi);
- (void) close(fo);
- (void) remove(file_copy);
- return;
}
if ((rem = s.st_size - written) < thresh) {
@@ -1231,10 +1217,6 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
}
err(EF_SYS, "cannot write into file %s", file_copy);
- (void) close(fi);
- (void) close(fo);
- (void) remove(file_copy);
- return;
}
} while (len >= 0);
@@ -1249,12 +1231,6 @@ docopytruncate(struct opts *opts, const char *file, const char *file_copy)
while ((len = read(fi, buf, sizeof (buf))) > 0)
if (write(fo, buf, len) != len) {
err(EF_SYS, "cannot write into file %s", file_copy);
- (void) lockf(fi, F_ULOCK, 0);
- (void) fchmod(fi, s.st_mode);
- (void) close(fi);
- (void) close(fo);
- (void) remove(file_copy);
- return;
}
(void) ftruncate(fi, 0);
diff --git a/usr/src/uts/i86pc/os/cpr_impl.c b/usr/src/uts/i86pc/os/cpr_impl.c
index f173a1dc57..cdc1a53fb1 100644
--- a/usr/src/uts/i86pc/os/cpr_impl.c
+++ b/usr/src/uts/i86pc/os/cpr_impl.c
@@ -23,6 +23,10 @@
*/
/*
+ * Copyright 2019 Joyent, Inc.
+ */
+
+/*
* Platform specific implementation code
* Currently only suspend to RAM is supported (ACPI S3)
*/
@@ -765,7 +769,7 @@ i_cpr_is_supported(int sleeptype)
*/
#ifdef __GNUC__
return (0);
-#endif
+#else
/*
* The next statement tests if a specific platform has turned off
@@ -781,6 +785,7 @@ i_cpr_is_supported(int sleeptype)
return (1);
return (pm_S3_enabled);
+#endif
}
void