summaryrefslogtreecommitdiff
path: root/usr/src/lib
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2020-01-20 01:54:27 -0800
committerToomas Soome <tsoome@me.com>2020-09-08 08:49:33 +0300
commit09e6639baaf32231365cb9895bf1e0ea006a2a60 (patch)
tree6ab6a5f33aa42e0efd069864b0d6700a15bd9579 /usr/src/lib
parente4af2f17fac5babc25d094f1bf22dd06515f66c7 (diff)
downloadillumos-joyent-09e6639baaf32231365cb9895bf1e0ea006a2a60.tar.gz
12885 efcode: smatch and build errors
Reviewed by: Igor Kozhukhov <igor@dilos.org> Reviewed by: Andy Fiddaman <andy@omniosce.org> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r--usr/src/lib/efcode/efdaemon/efdaemon.c24
-rw-r--r--usr/src/lib/efcode/engine/alarm.c14
-rw-r--r--usr/src/lib/efcode/engine/debug.c30
-rw-r--r--usr/src/lib/efcode/engine/env.c44
-rw-r--r--usr/src/lib/efcode/engine/extend.c4
-rw-r--r--usr/src/lib/efcode/engine/fcode.c9
-rw-r--r--usr/src/lib/efcode/engine/forth.c8
-rw-r--r--usr/src/lib/efcode/engine/interactive.c22
-rw-r--r--usr/src/lib/efcode/engine/log.c18
-rw-r--r--usr/src/lib/efcode/engine/package.c8
-rw-r--r--usr/src/lib/efcode/engine/properties.c4
-rw-r--r--usr/src/lib/efcode/engine/signal.c24
-rw-r--r--usr/src/lib/efcode/fcdriver/get_req.c8
-rw-r--r--usr/src/lib/efcode/fcdriver/ioctl.c4
-rw-r--r--usr/src/lib/efcode/fcdriver/load_node.c26
-rw-r--r--usr/src/lib/efcode/fcdriver/misc.c8
-rw-r--r--usr/src/lib/efcode/fcdriver/phandle.c19
-rw-r--r--usr/src/lib/efcode/fcdriver/upload.c5
-rw-r--r--usr/src/lib/efcode/gp2/gp2.c4
-rw-r--r--usr/src/lib/efcode/jupiter/jupiter.c2
-rw-r--r--usr/src/lib/efcode/packages/parse.c8
-rw-r--r--usr/src/lib/efcode/pci/pci.c9
-rw-r--r--usr/src/lib/efcode/upa/upa.c4
23 files changed, 137 insertions, 169 deletions
diff --git a/usr/src/lib/efcode/efdaemon/efdaemon.c b/usr/src/lib/efcode/efdaemon/efdaemon.c
index 2450d2d1fa..20321bf135 100644
--- a/usr/src/lib/efcode/efdaemon/efdaemon.c
+++ b/usr/src/lib/efcode/efdaemon/efdaemon.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* efdaemon - Emebbed Fcode Interpreter daemon.
*
@@ -89,7 +87,7 @@ main(int argc, char **argv)
strerror(errno));
exit(1);
}
- close(fd);
+ (void) close(fd);
/*
* Ensure that /usr/lib/efcode/efcode.sh exists and is executable.
@@ -113,10 +111,10 @@ main(int argc, char **argv)
/*
* detach from tty here.
*/
- setpgrp();
- close(0);
- close(1);
- close(2);
+ (void) setpgrp();
+ (void) close(0);
+ (void) close(1);
+ (void) close(2);
(void) open("/dev/null", O_RDWR);
(void) dup(0);
(void) dup(0);
@@ -127,7 +125,7 @@ main(int argc, char **argv)
if (nerr == 1)
syslog(LOG_ERR, "Can't open %s: %s\n",
dev_fcode_file, strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
if (nerr > 1) {
syslog(LOG_ERR, "Open on %s failed %d times\n",
@@ -138,7 +136,7 @@ main(int argc, char **argv)
if (nbytes < 0) {
syslog(LOG_ERR, "Read of %s: %s\n", dev_fcode_file,
strerror(errno));
- close(fd);
+ (void) close(fd);
continue;
}
if (debug)
@@ -148,7 +146,7 @@ main(int argc, char **argv)
if (nerr == 1)
syslog(LOG_ERR, "Fork failed: %s\n",
strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
if ((nerr > 1) && pid) {
syslog(LOG_ERR, "Fork failed %d times\n", nerr);
@@ -178,19 +176,19 @@ main(int argc, char **argv)
}
} else if (debug)
syslog(LOG_DEBUG, "Wait: pid: %d\n", pid);
- close(fd);
+ (void) close(fd);
continue;
}
if (debug)
syslog(LOG_DEBUG, "Child: %d processing request\n",
getpid());
- fcntl(fd, F_DUP2FD, 0);
+ (void) fcntl(fd, F_DUP2FD, 0);
while (execl("/bin/sh", "sh", efcode_sh_file, NULL)) {
nerr++;
if (nerr == 1)
syslog(LOG_ERR, "execl(/bin/sh) failed: %s\n",
strerror(errno));
- sleep(1);
+ (void) sleep(1);
}
}
diff --git a/usr/src/lib/efcode/engine/alarm.c b/usr/src/lib/efcode/engine/alarm.c
index c9d4550a9d..a50f965d8e 100644
--- a/usr/src/lib/efcode/engine/alarm.c
+++ b/usr/src/lib/efcode/engine/alarm.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -54,8 +52,8 @@ catch_alarm(int signo)
if (env && alarm_xt && alarm_ms) {
PUSH(DS, alarm_xt);
execute(env);
- signal(SIGALRM, catch_alarm);
- alarm((alarm_ms + 999)/1000);
+ (void) signal(SIGALRM, catch_alarm);
+ (void) alarm((alarm_ms + 999)/1000);
}
}
@@ -71,17 +69,17 @@ do_alarm(fcode_env_t *env)
ms = POP(DS);
xt = POP(DS);
if (ms == 0) {
- alarm(0);
- signal(SIGALRM, SIG_DFL);
+ (void) alarm(0);
+ (void) signal(SIGALRM, SIG_DFL);
alarm_xt = 0;
alarm_ms = 0;
alarm_env = 0;
} else {
- signal(SIGALRM, catch_alarm);
+ (void) signal(SIGALRM, catch_alarm);
alarm_xt = xt;
alarm_ms = ms;
alarm_env = env;
- alarm((ms + 999)/1000);
+ (void) alarm((ms + 999)/1000);
}
}
diff --git a/usr/src/lib/efcode/engine/debug.c b/usr/src/lib/efcode/engine/debug.c
index bbc32ebdf5..e00496944e 100644
--- a/usr/src/lib/efcode/engine/debug.c
+++ b/usr/src/lib/efcode/engine/debug.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -97,7 +95,7 @@ output_return_stack(fcode_env_t *env, int show_wa, int msglevel)
for (i = (RS - env->rs0) - 1; i > 0; i--) {
anyout++;
log_message(msglevel, "%s ",
- acf_backup_search(env, (acf_t)env->rs0[i+1]));
+ acf_backup_search(env, (acf_t)env->rs0[i+1]));
}
if (!anyout)
log_message(msglevel, "<empty> ");
@@ -239,7 +237,7 @@ acf_to_str(acf_t acf)
{
static char msg[(sizeof (acf) * 2) + 3];
- sprintf(msg, "(%08p)", acf);
+ (void) sprintf(msg, "(%08p)", acf);
return (msg);
}
@@ -622,9 +620,9 @@ verify_usage(fcode_env_t *env)
verify = env->table[i].flags & (ANSI_WORD|P1275_WORD);
if ((verify) &&
#ifdef DEBUG
- (env->table[i].usage == 0) &&
+ (env->table[i].usage == 0) &&
#endif
- (env->table[i].apf)) {
+ (env->table[i].apf)) {
log_message(MSG_DEBUG,
"Untested: %4x %32s acf = %8p, %8p\n", i,
env->table[i].name, env->table[i].apf,
@@ -726,11 +724,11 @@ debug_flags_to_mask(char *str)
if (*str == '0') {
str++;
if (*str == 'x' || *str == 'X') {
- sscanf(str + 1, "%x", &flags);
+ (void) sscanf(str + 1, "%x", &flags);
} else
- sscanf(str, "%o", &flags);
+ (void) sscanf(str, "%o", &flags);
} else
- sscanf(str, "%d", &flags);
+ (void) sscanf(str, "%d", &flags);
return (flags);
}
if (strcmp(str, "clear") == 0)
@@ -929,13 +927,13 @@ ctrace(fcode_env_t *env)
FILE *fd;
log_message(MSG_DEBUG, "Interpreter C Stack:\n");
- sprintf(buf, "/usr/proc/bin/pstack %d", getpid());
+ (void) sprintf(buf, "/usr/proc/bin/pstack %d", getpid());
if ((fd = popen(buf, "r")) == NULL)
log_perror(MSG_ERROR, "Can't run: %s", buf);
else {
while (fgets(buf, sizeof (buf), fd))
log_message(MSG_DEBUG, buf);
- fclose(fd);
+ (void) fclose(fd);
}
}
@@ -969,7 +967,7 @@ forth_abort(fcode_env_t *env, char *fmt, ...)
in_forth_abort++;
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
log_message(MSG_ERROR, "ABORT: %s\n", msg);
if (env) {
@@ -995,7 +993,7 @@ forth_perror(fcode_env_t *env, char *fmt, ...)
int save_errno = errno; /* just in case... */
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
forth_abort(env, "%s: %s", msg, strerror(save_errno));
}
@@ -1048,7 +1046,7 @@ dump(fcode_env_t *env)
offset = ((long)data) & 0xf;
len += offset;
data = (uchar_t *)((long)data & ~0xf);
- sprintf(buf, "%p", data);
+ (void) sprintf(buf, "%p", data);
print_bytes_header(strlen(buf), offset);
for (len += offset; len > 0; len -= 16, data += 16)
dump_line(data);
@@ -1412,7 +1410,7 @@ dot_calls(fcode_env_t *env)
{
acf_t acf = (acf_t)POP(DS);
- search_all_dictionaries(env, do_dot_calls, acf);
+ (void) search_all_dictionaries(env, do_dot_calls, acf);
output_acf_name(NULL);
}
@@ -1484,7 +1482,7 @@ do_memory_watch(fcode_env_t *env)
"memory-watch: %p/%d: %llx -> %llx\n",
mw_addr, mw_size, (uint64_t)mw_lastvalue,
(uint64_t)value);
- do_fclib_step(env);
+ (void) do_fclib_step(env);
}
mw_lastvalue = value;
}
diff --git a/usr/src/lib/efcode/engine/env.c b/usr/src/lib/efcode/engine/env.c
index 16431b21dd..5d6580dcb8 100644
--- a/usr/src/lib/efcode/engine/env.c
+++ b/usr/src/lib/efcode/engine/env.c
@@ -64,7 +64,7 @@ do_emit(fcode_env_t *env, uchar_t c)
if (isatty(fileno(stdout))) {
if ((c >= 0x20 && c <= 0x7f) || c == '\n' || c == '\r' ||
c == '\b')
- putchar(c);
+ (void) putchar(c);
else if (c < 0x20)
printf("@%c", c + '@');
else
@@ -100,14 +100,14 @@ keyquestion(fcode_env_t *env)
{
struct timeval timeval;
fd_set readfds;
- int ret;
if (isatty(fileno(stdin))) {
FD_ZERO(&readfds);
FD_SET(fileno(stdin), &readfds);
timeval.tv_sec = 0;
timeval.tv_usec = 1000;
- ret = select(fileno(stdin) + 1, &readfds, NULL, NULL, &timeval);
+ (void) select(fileno(stdin) + 1, &readfds, NULL, NULL,
+ &timeval);
if (FD_ISSET(fileno(stdin), &readfds))
PUSH(DS, TRUE);
else
@@ -125,7 +125,7 @@ key(fcode_env_t *env)
uchar_t c;
if (isatty(fileno(stdin))) {
- read(fileno(stdin), &c, 1);
+ (void) read(fileno(stdin), &c, 1);
PUSH(DS, c);
} else
forth_abort(env, "'key' called in non-interactive mode");
@@ -178,7 +178,7 @@ expect(fcode_env_t *env)
read_line(env);
rbuf = pop_a_string(env, NULL);
if (rbuf) {
- strcpy(buf, rbuf);
+ (void) strcpy(buf, rbuf);
env->span = strlen(buf);
} else
env->span = 0;
@@ -201,7 +201,7 @@ do_ms(fcode_env_t *env)
if (d) {
rqtp.tv_sec = 0;
rqtp.tv_nsec = d*1000*1000;
- nanosleep(&rqtp, 0);
+ (void) nanosleep(&rqtp, 0);
}
}
@@ -212,12 +212,12 @@ do_get_msecs(fcode_env_t *env)
long ms;
timespec_t rqtp;
- gettimeofday(&tp, NULL);
+ (void) gettimeofday(&tp, NULL);
ms = (tp.tv_usec/1000) + (tp.tv_sec * 1000);
PUSH(DS, (fstack_t)ms);
rqtp.tv_sec = 0;
rqtp.tv_nsec = 1000*1000;
- nanosleep(&rqtp, 0);
+ (void) nanosleep(&rqtp, 0);
}
#define CMN_MSG_SIZE 256
@@ -334,7 +334,7 @@ validfmt(char *fmt, cmn_fmt_t *cfstr)
/* if too many digits in the width return error */
if (nbytes > CMN_MAX_DIGITS)
return (1);
- strncpy(cdigs, dig1, nbytes);
+ (void) strncpy(cdigs, dig1, nbytes);
cdigs[nbytes] = 0;
*cwidth = atoi(cdigs);
}
@@ -353,6 +353,7 @@ validfmt(char *fmt, cmn_fmt_t *cfstr)
case '%':
if (isll)
return (1);
+ /* FALLTHROUGH */
case 'd':
case 'x':
*format = *fmt;
@@ -408,6 +409,7 @@ fmt_args(fcode_env_t *env, int cw, int fw, char format, long *arg,
switch (format) {
case 'x':
cnv = 16;
+ /* FALLTHROUGH */
case 'd':
case 'c':
case 'p':
@@ -551,9 +553,9 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
}
bytes = pct - fmt;
- strncpy(tbuf, fmt, bytes);
- strncpy(tbuf+bytes, "%", 1);
- strncpy(tbuf+bytes+1, fmt+bytes, 1);
+ (void) strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf+bytes, "%", 1);
+ (void) strncpy(tbuf+bytes+1, fmt+bytes, 1);
bytes += 2;
tbuf[bytes] = 0;
@@ -561,25 +563,25 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
"fmt_str: invalid format type! (%s)\n",
tbuf+bytes-3);
- strncpy(fmtbuf, tbuf, bsize);
+ (void) strncpy(fmtbuf, tbuf, bsize);
return;
}
if (fw > 0) { /* process normal (not long) formats */
bytes = pct - fmt + fw;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 0;
} else {
/* if here, fw must be a long format */
if (*fmptr == 'p') {
bytes = pct - fmt - fw;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 0;
} else {
bytes = pct - fmt - fw - 2;
- strncpy(tbuf, fmt, bytes);
+ (void) strncpy(tbuf, fmt, bytes);
tbuf[bytes] = 'l';
- strncpy(tbuf+bytes+1, fmt+bytes, 2);
+ (void) strncpy(tbuf+bytes+1, fmt+bytes, 2);
tbuf[bytes+1+2] = 0;
}
}
@@ -616,7 +618,7 @@ fmt_str(fcode_env_t *env, char *fmt, char *fmtbuf, int bsize)
(void) snprintf(fmtbuf, bsize, tbuf, llarg);
} else
- strncpy(fmtbuf, fmt, bsize);
+ (void) strncpy(fmtbuf, fmt, bsize);
}
/*
@@ -718,13 +720,13 @@ fc_cmn_start(fcode_env_t *env, char *head, int path)
new->prev = root;
if (root != 0)
root->next = new;
- strcpy(new->buf, head);
+ (void) strcpy(new->buf, head);
new->len = strlen(head);
if (path && env->current_device) {
dpath = get_path(env, env->current_device);
- strcpy(new->buf+new->len, dpath);
+ (void) strcpy(new->buf+new->len, dpath);
new->len += strlen(dpath);
- strncpy(new->buf+new->len++, ": ", 2);
+ (void) strncpy(new->buf+new->len++, ": ", 2);
++new->len;
free(dpath);
}
diff --git a/usr/src/lib/efcode/engine/extend.c b/usr/src/lib/efcode/engine/extend.c
index 9e631012b2..edca69097d 100644
--- a/usr/src/lib/efcode/engine/extend.c
+++ b/usr/src/lib/efcode/engine/extend.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <sys/shm.h>
#include <dlfcn.h>
@@ -57,7 +55,7 @@ static void
do_dlclose(fcode_env_t *env)
{
void *pl = (void *)POP(DS);
- dlclose(pl);
+ (void) dlclose(pl);
}
static void
diff --git a/usr/src/lib/efcode/engine/fcode.c b/usr/src/lib/efcode/engine/fcode.c
index e8cedb3816..2ddbda64fc 100644
--- a/usr/src/lib/efcode/engine/fcode.c
+++ b/usr/src/lib/efcode/engine/fcode.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -339,7 +337,7 @@ token_common(fcode_env_t *env, int headered, int visible)
env->table[token].flags = 0;
if (len) {
env->table[token].name = MALLOC(len+1);
- strncpy(env->table[token].name, namebuff, len);
+ (void) strncpy(env->table[token].name, namebuff, len);
} else {
env->table[token].name = NULL;
}
@@ -542,7 +540,7 @@ byte_load(fcode_env_t *env)
DEBUGF(TOKEN_USAGE, entry->usage++);
PUSH(DS, (fstack_t)apf);
if ((env->state) &&
- ((entry->flags & IMMEDIATE) == 0)) {
+ ((entry->flags & IMMEDIATE) == 0)) {
/* Compile in references */
compile_comma(env);
} else {
@@ -709,7 +707,8 @@ get_token(fcode_env_t *env)
tok = POP(DS);
tok &= MAX_FCODE;
PUSH(DS, (fstack_t)env->table[tok].apf);
- if (env->table[tok].flags & IMMEDIATE) immediate = 1;
+ if (env->table[tok].flags & IMMEDIATE)
+ immediate = 1;
PUSH(DS, immediate);
}
diff --git a/usr/src/lib/efcode/engine/forth.c b/usr/src/lib/efcode/engine/forth.c
index 33bd2c37d1..ddf7007b5f 100644
--- a/usr/src/lib/efcode/engine/forth.c
+++ b/usr/src/lib/efcode/engine/forth.c
@@ -23,8 +23,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -288,7 +286,7 @@ f_exit(fcode_env_t *env)
#define COMPARE(cmp, rhs) ((((s_lforth_t)TOS) cmp((s_lforth_t)(rhs))) ? \
TRUE : FALSE)
-#define UCOMPARE(cmp, rhs) ((((u_lforth_t)TOS) cmp((u_lforth_t)(rhs))) ? \
+#define UCOMPARE(cmp, rhs) ((((u_lforth_t)TOS) cmp((u_lforth_t)(rhs))) ? \
TRUE : FALSE)
#define EQUALS ==
#define NOTEQUALS !=
@@ -689,7 +687,7 @@ pack_str(fcode_env_t *env)
str = (char *)TOS;
TOS = (fstack_t)buf;
*buf++ = (uchar_t)len;
- strncpy(buf, str, (len&0xff));
+ (void) strncpy(buf, str, (len&0xff));
}
void
@@ -2416,7 +2414,7 @@ throw_from_fclib(fcode_env_t *env, fstack_t errcode, char *fmt, ...)
char msg[256];
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
if (errcode) {
diff --git a/usr/src/lib/efcode/engine/interactive.c b/usr/src/lib/efcode/engine/interactive.c
index 398f52a686..942f8dcd13 100644
--- a/usr/src/lib/efcode/engine/interactive.c
+++ b/usr/src/lib/efcode/engine/interactive.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -104,7 +102,7 @@ defer(fcode_env_t *env)
PUSH(DS, (fstack_t)&crash_ptr);
name = parse_a_string(env, &len);
make_common_access(env, name, len, 1,
- env->instance_mode, &noop, &noop, &set_defer_actions);
+ env->instance_mode, &noop, &noop, &set_defer_actions);
}
void
@@ -343,7 +341,7 @@ load_file(fcode_env_t *env)
if (fd < 0) {
forth_perror(env, "Can't open '%s'", name);
}
- fstat(fd, &buf);
+ (void) fstat(fd, &buf);
len = buf.st_size;
buffer = MALLOC(len);
if (buffer == 0)
@@ -352,7 +350,7 @@ load_file(fcode_env_t *env)
if ((n = read(fd, buffer, len)) < 0)
forth_perror(env, "read error '%s'", name);
- close(fd);
+ (void) close(fd);
PUSH(DS, (fstack_t)buffer);
PUSH(DS, (fstack_t)n);
}
@@ -504,18 +502,18 @@ read_line(fcode_env_t *env)
struct termio termio, savetermio;
if (!isatty(fileno(stdin))) {
- fgets(buf, sizeof (buf), stdin);
+ (void) fgets(buf, sizeof (buf), stdin);
push_string(env, buf, strlen(buf));
return;
}
printf(prompt_string);
fflush(stdout);
- ioctl(fileno(stdin), TCGETA, &termio);
+ (void) ioctl(fileno(stdin), TCGETA, &termio);
savetermio = termio;
termio.c_lflag &= ~(ICANON|ECHO|ECHOE|IEXTEN);
termio.c_cc[VTIME] = 0;
termio.c_cc[VMIN] = 1;
- ioctl(fileno(stdin), TCSETA, &termio);
+ (void) ioctl(fileno(stdin), TCSETA, &termio);
my_line = cur_line = num_lines;
save_buf[0] = '\0';
for (cursor = eol = buf; ; ) {
@@ -627,7 +625,7 @@ read_line(fcode_env_t *env)
redraw_line(env, buf, cursor, eol,
save_line, save_line + save_cursor,
save_line + len);
- strcpy(buf, save_line);
+ (void) strcpy(buf, save_line);
eol = buf + len;
cursor = buf + save_cursor;
continue;
@@ -636,7 +634,7 @@ read_line(fcode_env_t *env)
p = history_lines[cur_line];
len = strlen(p);
redraw_line(env, buf, cursor, eol, p, p, p + len);
- strcpy(buf, history_lines[cur_line]);
+ (void) strcpy(buf, history_lines[cur_line]);
cursor = buf;
eol = buf + len;
continue;
@@ -753,7 +751,7 @@ read_line(fcode_env_t *env)
break;
}
add_line_to_history(env, buf);
- ioctl(fileno(stdin), TCSETA, &savetermio);
+ (void) ioctl(fileno(stdin), TCSETA, &savetermio);
push_string(env, buf, strlen(buf));
}
@@ -763,7 +761,7 @@ set_prompt(fcode_env_t *env)
char *prompt;
if ((prompt = parse_a_string(env, NULL)) != NULL)
- strncpy(prompt_string, prompt, sizeof (prompt_string));
+ (void) strncpy(prompt_string, prompt, sizeof (prompt_string));
}
#pragma init(_init)
diff --git a/usr/src/lib/efcode/engine/log.c b/usr/src/lib/efcode/engine/log.c
index b17f38b8c4..12b7687736 100644
--- a/usr/src/lib/efcode/engine/log.c
+++ b/usr/src/lib/efcode/engine/log.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
/*
* Daemon log message. This can direct log messages to either stdout,
* an error log file or syslog (or any combination).
@@ -183,22 +181,22 @@ log_message(int msg_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
if (log_to_stdout(msg_level)) {
printf(msg);
fflush(stdout);
}
if (log_to_error_log(msg_level)) {
- fprintf(error_log_fp, msg);
- fflush(error_log_fp);
+ (void) fprintf(error_log_fp, msg);
+ (void) fflush(error_log_fp);
}
if (log_to_syslog(msg_level)) {
if (strlen(log_msg) + strlen(msg) > LOG_LINESIZE - 1) {
syslog(msg_level_to_syslog(msg_level), log_msg);
log_msg[0] = '\0';
}
- strcat(log_msg, msg);
+ (void) strcat(log_msg, msg);
if ((p = strchr(log_msg, '\n')) != NULL) {
*p = '\0';
syslog(msg_level_to_syslog(msg_level), log_msg);
@@ -221,7 +219,7 @@ debug_msg(int debug_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
+ (void) vsprintf(msg, fmt, ap);
log_message(MSG_DEBUG, msg);
}
@@ -237,8 +235,8 @@ log_perror(int msg_level, char *fmt, ...)
va_start(ap, fmt);
- vsprintf(msg, fmt, ap);
- sprintf(tmp, "%s: %s\n", msg, strerror(errno));
+ (void) vsprintf(msg, fmt, ap);
+ (void) sprintf(tmp, "%s: %s\n", msg, strerror(errno));
log_message(msg_level, tmp);
}
@@ -333,7 +331,7 @@ set_error_log(fcode_env_t *env)
return;
}
if (error_log_fp)
- fclose(error_log_fp);
+ (void) fclose(error_log_fp);
if (error_log_name)
FREE(error_log_name);
error_log_fp = fp;
diff --git a/usr/src/lib/efcode/engine/package.c b/usr/src/lib/efcode/engine/package.c
index 54a75dfe88..2ba034c1a4 100644
--- a/usr/src/lib/efcode/engine/package.c
+++ b/usr/src/lib/efcode/engine/package.c
@@ -588,7 +588,7 @@ locate_package(fcode_env_t *env, char *start)
if ((next_p = strchr(p, ':')) != NULL)
*next_p++ = '\0';
tpath = MALLOC(strlen(p) + strlen(start) + 2);
- sprintf(tpath, "%s/%s", p, start);
+ (void) sprintf(tpath, "%s/%s", p, start);
if ((d = match_package_path(env, tpath)) != NULL) {
FREE(fpath);
FREE(tpath);
@@ -706,10 +706,10 @@ get_path(fcode_env_t *env, device_t *d)
name = get_package_name(env, d);
n = strlen(pre_path) + strlen(name) + 1;
path = MALLOC(n);
- strcpy(path, pre_path);
- strcat(path, name);
+ (void) strcpy(path, pre_path);
+ (void) strcat(path, name);
if (d->child && d->parent)
- strcat(path, "/");
+ (void) strcat(path, "/");
FREE(pre_path);
return (path);
}
diff --git a/usr/src/lib/efcode/engine/properties.c b/usr/src/lib/efcode/engine/properties.c
index ff14c1f03c..966d0f005b 100644
--- a/usr/src/lib/efcode/engine/properties.c
+++ b/usr/src/lib/efcode/engine/properties.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -738,7 +736,7 @@ print_property(fcode_env_t *env, prop_t *p, char *prepend)
char *name = (p->name ? p->name : "<noname>");
if (prepend) {
- sprintf(buf, "%s %s", prepend, name);
+ (void) snprintf(buf, sizeof (buf), "%s %s", prepend, name);
name = buf;
}
print_indented(name);
diff --git a/usr/src/lib/efcode/engine/signal.c b/usr/src/lib/efcode/engine/signal.c
index a023bfd857..eed5c962d9 100644
--- a/usr/src/lib/efcode/engine/signal.c
+++ b/usr/src/lib/efcode/engine/signal.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -55,14 +53,14 @@ process_signal(int sig, siginfo_t *sip, void *addr)
case SIGFPE:
forth_abort(saved_envp, "%s: Fault Addr: 0x%08x",
strsignal(sig), sip->si_addr);
-
+ /* FALLTHROUGH */
case SIGQUIT:
- ioctl(fileno(stdin), TCSETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCSETA, &saved_termio);
log_message(MSG_FATAL, "SIGQUIT\n");
abort();
case SIGINT:
- ioctl(fileno(stdin), TCSETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCSETA, &saved_termio);
break;
}
forth_abort(saved_envp, strsignal(sig));
@@ -75,17 +73,17 @@ install_handlers(fcode_env_t *env)
saved_envp = env;
- ioctl(fileno(stdin), TCGETA, &saved_termio);
+ (void) ioctl(fileno(stdin), TCGETA, &saved_termio);
- sigemptyset(&sa.sa_mask);
+ (void) sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_SIGINFO|SA_NODEFER;
sa.sa_handler = 0;
sa.sa_sigaction = process_signal;
- sigaction(SIGINT, &sa, NULL);
- sigaction(SIGQUIT, &sa, NULL);
- sigaction(SIGSEGV, &sa, NULL);
- sigaction(SIGBUS, &sa, NULL);
- sigaction(SIGUSR1, &sa, NULL);
- sigaction(SIGFPE, &sa, NULL);
+ (void) sigaction(SIGINT, &sa, NULL);
+ (void) sigaction(SIGQUIT, &sa, NULL);
+ (void) sigaction(SIGSEGV, &sa, NULL);
+ (void) sigaction(SIGBUS, &sa, NULL);
+ (void) sigaction(SIGUSR1, &sa, NULL);
+ (void) sigaction(SIGFPE, &sa, NULL);
}
diff --git a/usr/src/lib/efcode/fcdriver/get_req.c b/usr/src/lib/efcode/fcdriver/get_req.c
index 2fd07e4fec..dbe3dabb82 100644
--- a/usr/src/lib/efcode/fcdriver/get_req.c
+++ b/usr/src/lib/efcode/fcdriver/get_req.c
@@ -178,8 +178,8 @@ save_fcode_to_file(fcode_env_t *env)
return;
}
log_message(MSG_INFO, "Fcode %p,%x to file '%s'\n", buf, len, fname);
- fwrite(buf, len, sizeof (char), fd);
- fclose(fd);
+ (void) fwrite(buf, len, sizeof (char), fd);
+ (void) fclose(fd);
}
void
@@ -325,7 +325,7 @@ get_request(fcode_env_t *env)
common_data_t *cdp = env->private;
if (cdp->fcode_fd >= 0)
- close(cdp->fcode_fd);
+ (void) close(cdp->fcode_fd);
if (!open_fcode_dev(env))
exit(1);
if (!fc_get_request(cdp)) {
@@ -405,7 +405,7 @@ finish_request(fcode_env_t *env)
{
common_data_t *cdp = env->private;
- close(cdp->fcode_fd);
+ (void) close(cdp->fcode_fd);
}
/*
diff --git a/usr/src/lib/efcode/fcdriver/ioctl.c b/usr/src/lib/efcode/fcdriver/ioctl.c
index 218ceb88db..7a40d98979 100644
--- a/usr/src/lib/efcode/fcdriver/ioctl.c
+++ b/usr/src/lib/efcode/fcdriver/ioctl.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -85,7 +83,7 @@ fc_run_priv(common_data_t *cdp, char *service, int nin, int nout, ...)
error_msg = "Error";
error = 1;
}
- if ((error & !no_err) ||
+ if ((error && !no_err) ||
(get_interpreter_debug_level() & DEBUG_REG_ACCESS)) {
if (error)
log_message(MSG_ERROR, "%s: FC_RUN_PRIV: %s: ",
diff --git a/usr/src/lib/efcode/fcdriver/load_node.c b/usr/src/lib/efcode/fcdriver/load_node.c
index 613a1f94f6..efbd9caa5b 100644
--- a/usr/src/lib/efcode/fcdriver/load_node.c
+++ b/usr/src/lib/efcode/fcdriver/load_node.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -71,22 +69,22 @@ build_default_search_path(char *arch)
struct utsname utsname;
int len;
- sysinfo(SI_PLATFORM, platform, sizeof (platform));
- uname(&utsname);
+ (void) sysinfo(SI_PLATFORM, platform, sizeof (platform));
+ (void) uname(&utsname);
len = strlen(search_proto) + strlen(platform) + strlen(utsname.machine);
if (*arch != '\0') {
len += len + (3 * strlen(arch)) + 1;
}
default_search_path = MALLOC(len);
if (*arch != '\0') {
- sprintf(default_search_path, search_proto, platform, arch,
- utsname.machine, arch, arch);
+ (void) sprintf(default_search_path, search_proto, platform,
+ arch, utsname.machine, arch, arch);
p = default_search_path + strlen(default_search_path);
*p++ = ':';
} else
p = default_search_path;
- sprintf(p, search_proto, platform, "", utsname.machine, "", "");
+ (void) sprintf(p, search_proto, platform, "", utsname.machine, "", "");
}
static void
@@ -121,7 +119,7 @@ search_path(char *name, char *search, int (*fn)(char *))
if ((next_p = strchr(p, ':')) != NULL)
*next_p++ = '\0';
tpath = MALLOC(strlen(p) + strlen(name) + 2);
- sprintf(tpath, "%s/%s", p, name);
+ (void) sprintf(tpath, "%s/%s", p, name);
if ((*fn)(tpath)) {
FREE(fpath);
return (tpath);
@@ -169,13 +167,13 @@ is_fcode_file(char *path)
if (fstat(fd, &statb) != 0 || read(fd, header, sizeof (header)) < 0) {
debug_msg(DEBUG_FIND_FCODE, "%s: '%s' can't fstat/read\n",
func_name, path);
- close(fd);
+ (void) close(fd);
return (0);
}
status = check_fcode_header(path, header, statb.st_size);
debug_msg(DEBUG_FIND_FCODE, "%s: '%s' format %s\n", func_name, path,
status ? "OK" : "NOT OK");
- close(fd);
+ (void) close(fd);
return (status);
}
@@ -194,7 +192,7 @@ find_lib_file(fcode_env_t *env, char *prefix, char *name, char *suffix,
}
lib_name = MALLOC(strlen(name) + strlen(prefix) + strlen(suffix) + 1);
- sprintf(lib_name, "%s%s%s", prefix, name, suffix);
+ (void) sprintf(lib_name, "%s%s%s", prefix, name, suffix);
fname = search_path(lib_name, search, fn);
FREE(lib_name);
return (fname);
@@ -245,8 +243,8 @@ install_node_data(fcode_env_t *env, device_t *d)
* build the property node returned, so we have to grab a copy
* of the data.
*/
- strcpy(libname, (char *)p->data);
- strcat(libname, "_");
+ (void) strcpy(libname, (char *)p->data);
+ (void) strcat(libname, "_");
} else
libname[0] = '\0';
@@ -261,7 +259,7 @@ install_node_data(fcode_env_t *env, device_t *d)
* the property node returned, so we have to grab a copy of the
* data.
*/
- strcat(libname, (char *)p->data);
+ (void) strcat(libname, (char *)p->data);
debug_msg(DEBUG_FIND_FCODE, "%s: `%s` lname: '%s'\n", func_name,
get_path(env, d), libname);
diff --git a/usr/src/lib/efcode/fcdriver/misc.c b/usr/src/lib/efcode/fcdriver/misc.c
index b2ea8a9e00..d0891aa9a6 100644
--- a/usr/src/lib/efcode/fcdriver/misc.c
+++ b/usr/src/lib/efcode/fcdriver/misc.c
@@ -24,8 +24,6 @@
* Use is subject to license terms.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -463,11 +461,11 @@ get_eeprom_value(fcode_env_t *env, char *name)
FILE *fd;
char buf[80], *p;
- sprintf(buf, "eeprom '%s'", name);
+ (void) sprintf(buf, "eeprom '%s'", name);
if ((fd = popen(buf, "r")) == NULL)
return (NULL);
- fgets(buf, sizeof (buf), fd);
- pclose(fd);
+ (void) fgets(buf, sizeof (buf), fd);
+ (void) pclose(fd);
if ((p = strchr(buf, '\n')) != NULL)
*p = '\0';
if ((p = strchr(buf, '=')) != NULL)
diff --git a/usr/src/lib/efcode/fcdriver/phandle.c b/usr/src/lib/efcode/fcdriver/phandle.c
index 79a202da4e..fddca08ef0 100644
--- a/usr/src/lib/efcode/fcdriver/phandle.c
+++ b/usr/src/lib/efcode/fcdriver/phandle.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -78,13 +76,13 @@ convert_phandle(fcode_env_t *env, fstack_t d)
if (use_os_handle) {
my_nodeid_t nh;
- nh.my_handle = (fc_phandle_t) d;
+ nh.my_handle = (fc_phandle_t)d;
t = find_resource(&cdp->nodeids, &nh, match_handle);
if (t == NULL) {
r = 0;
} else {
- my_nodeid_t *p = (my_nodeid_t *) t->data;
- r = (device_t *) p->node;
+ my_nodeid_t *p = (my_nodeid_t *)t->data;
+ r = (device_t *)p->node;
}
} else
r = (device_t *)d;
@@ -108,11 +106,11 @@ revert_phandle(fcode_env_t *env, device_t *d)
if (t == NULL) {
r = 0;
} else {
- my_nodeid_t *p = (my_nodeid_t *) t->data;
- r = (fstack_t) p->my_handle;
+ my_nodeid_t *p = (my_nodeid_t *)t->data;
+ r = (fstack_t)p->my_handle;
}
} else
- r = (fstack_t) d;
+ r = (fstack_t)d;
return (r);
}
@@ -135,7 +133,6 @@ allocate_phandle(fcode_env_t *env)
{
private_data_t *pd;
common_data_t *cdp;
- int error;
char *service;
device_t *current;
fc_cell_t hcell;
@@ -160,11 +157,11 @@ allocate_phandle(fcode_env_t *env)
pd = MALLOC(sizeof (private_data_t));
pd->common = cdp;
- pd->parent = (fc_phandle_t) revert_phandle(env, current->parent);
+ pd->parent = (fc_phandle_t)revert_phandle(env, current->parent);
pd->upload = (cdp->init_done == 1);
current->private = pd;
- error = fc_run_priv(cdp, service, 0, 1, &hcell);
+ (void) fc_run_priv(cdp, service, 0, 1, &hcell);
pd->node = fc_cell2phandle(hcell);
diff --git a/usr/src/lib/efcode/fcdriver/upload.c b/usr/src/lib/efcode/fcdriver/upload.c
index 14b8989295..18db29fe55 100644
--- a/usr/src/lib/efcode/fcdriver/upload.c
+++ b/usr/src/lib/efcode/fcdriver/upload.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
@@ -157,10 +155,9 @@ upload_nodes(fcode_env_t *env)
void
validate_nodes(fcode_env_t *env)
{
- int error;
common_data_t *cdp = env->private;
- error = ioctl(cdp->fcode_fd, FC_VALIDATE);
+ (void) ioctl(cdp->fcode_fd, FC_VALIDATE);
}
#pragma init(_init)
diff --git a/usr/src/lib/efcode/gp2/gp2.c b/usr/src/lib/efcode/gp2/gp2.c
index bdc8f2d72f..50f222a7bd 100644
--- a/usr/src/lib/efcode/gp2/gp2.c
+++ b/usr/src/lib/efcode/gp2/gp2.c
@@ -163,9 +163,9 @@ do_encode_unit(fcode_env_t *env)
off = lo & 0x7fffff; /* build config offset */
if (off) {
- sprintf(enc_buf, "%x,%x", id, off);
+ (void) sprintf(enc_buf, "%x,%x", id, off);
} else {
- sprintf(enc_buf, "%x", id);
+ (void) sprintf(enc_buf, "%x", id);
}
debug_msg(DEBUG_REG_ACCESS, "gp2:encode_unit ( %x %x ) -> '%s'\n",
(int)hi, (int)lo, enc_buf);
diff --git a/usr/src/lib/efcode/jupiter/jupiter.c b/usr/src/lib/efcode/jupiter/jupiter.c
index 823cbe1b5f..b11f162613 100644
--- a/usr/src/lib/efcode/jupiter/jupiter.c
+++ b/usr/src/lib/efcode/jupiter/jupiter.c
@@ -239,7 +239,7 @@ do_device_id(fcode_env_t *env)
lo = POP(DS);
portid = 0;
- if (cdp && cdp->fc.unit_address &&
+ if (cdp != NULL && *cdp->fc.unit_address != '\0' &&
((buf = strdup(cdp->fc.unit_address)) != NULL)) {
/*
* Get portid number from unit_address
diff --git a/usr/src/lib/efcode/packages/parse.c b/usr/src/lib/efcode/packages/parse.c
index b75dd73ee5..9377f96708 100644
--- a/usr/src/lib/efcode/packages/parse.c
+++ b/usr/src/lib/efcode/packages/parse.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
@@ -41,7 +39,7 @@ byte_loadfile(fcode_env_t *env)
int len;
load_file(env);
- len = (int) POP(DS);
+ len = (int)POP(DS);
if (len) {
void *ptr = (void *) TOS;
PUSH(DS, 1);
@@ -60,7 +58,7 @@ define_hook(fcode_env_t *env, char *name, int len, char *fcimage)
header(env, name, len, 0);
COMPILE_TOKEN(&do_colon);
env->state |= 1;
- PUSH(DS, (fstack_t) fcimage);
+ PUSH(DS, (fstack_t)fcimage);
PUSH(DS, strlen(fcimage));
compile_string(env);
COMPILE_TOKEN(&byteload_ptr);
@@ -131,5 +129,5 @@ make_builtin_hooks(fcode_env_t *env, char *where)
}
}
FREE(buffer);
- fclose(fd);
+ (void) fclose(fd);
}
diff --git a/usr/src/lib/efcode/pci/pci.c b/usr/src/lib/efcode/pci/pci.c
index 2ee4fc02c2..02fa8bd866 100644
--- a/usr/src/lib/efcode/pci/pci.c
+++ b/usr/src/lib/efcode/pci/pci.c
@@ -241,9 +241,9 @@ do_encode_unit(fcode_env_t *env)
dev = ((hi >> 11) & 0x1f);
if (fn) {
- sprintf(enc_buf, "%x,%x", dev, fn);
+ (void) sprintf(enc_buf, "%x,%x", dev, fn);
} else {
- sprintf(enc_buf, "%x", dev);
+ (void) sprintf(enc_buf, "%x", dev);
}
debug_msg(DEBUG_REG_ACCESS, "pci:encode-unit ( %x ) -> %s\n",
hi, enc_buf);
@@ -287,7 +287,7 @@ do_device_id(fcode_env_t *env)
PUSH(DS, cfgadd + PCI_CONF_DEVID);
config_wfetch(env);
dev_id = POP(DS);
- sprintf(buf, "pci%x,%x", ven_id, dev_id);
+ (void) sprintf(buf, "pci%x,%x", ven_id, dev_id);
push_a_string(env, STRDUP(buf));
}
@@ -311,7 +311,8 @@ do_class_id(fcode_env_t *env)
PUSH(DS, cfgadd + PCI_CONF_PROGCLASS);
config_bfetch(env);
progclass = POP(DS);
- sprintf(buf, "pciclass%02x%02x%02x", basclass, subclass, progclass);
+ (void) sprintf(buf, "pciclass%02x%02x%02x", basclass, subclass,
+ progclass);
push_a_string(env, STRDUP(buf));
}
diff --git a/usr/src/lib/efcode/upa/upa.c b/usr/src/lib/efcode/upa/upa.c
index 251dd5183d..60993a6aa6 100644
--- a/usr/src/lib/efcode/upa/upa.c
+++ b/usr/src/lib/efcode/upa/upa.c
@@ -24,8 +24,6 @@
* All rights reserved.
*/
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <stdio.h>
#include <string.h>
#include <fcode/private.h>
@@ -51,7 +49,7 @@ do_encode_unit(fcode_env_t *env)
hi = POP(DS);
lo = POP(DS);
hi = ((hi >> 1) & 0x1f);
- sprintf(buf, "%x,%x", hi, lo);
+ (void) sprintf(buf, "%x,%x", hi, lo);
push_a_string(env, buf);
}