summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>1999-11-24 19:18:57 +0000
committern_hibma <n_hibma@FreeBSD.org>1999-11-24 19:18:57 +0000
commite0cf3d9b909ef7c0f8e421deaace71ad77f4a655 (patch)
treee392a7e3e6292c184e9264ea9289d0059ab576bb
parent3d54d3434fec937f572d6dfa7e3410633ac46a9a (diff)
downloadFreeBSD-src-e0cf3d9b909ef7c0f8e421deaace71ad77f4a655.zip
FreeBSD-src-e0cf3d9b909ef7c0f8e421deaace71ad77f4a655.tar.gz
Avoid null dereference on verbose output.
Submitted-By: Doug Ambrisko <ambrisko@whistle.com> Don't print a warning on exit status 0.
-rw-r--r--usr.sbin/usbd/usbd.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/usr.sbin/usbd/usbd.c b/usr.sbin/usbd/usbd.c
index 33e29f2..f5371ae 100644
--- a/usr.sbin/usbd/usbd.c
+++ b/usr.sbin/usbd/usbd.c
@@ -611,15 +611,15 @@ find_action(struct usb_device_info *devinfo)
(action->protocol == WILDCARD_INT ||
action->protocol == devinfo->protocol)) {
/* found match !*/
- break;
+ if (verbose)
+ printf("%s: Found action '%s' for %s, %s\n",
+ __progname, action->name,
+ devinfo->product, devinfo->vendor);
+ return(action);
}
}
- if (verbose)
- printf("%s: Found action '%s' for %s, %s\n",
- __progname, action->name,
- devinfo->product, devinfo->vendor);
- return(action);
+ return NULL;
}
void
@@ -695,7 +695,7 @@ execute_command(char *cmd)
} else if (status == 127) {
fprintf(stderr, "%s: Shell failed for '%s'\n",
__progname, cmd);
- } else if (WIFEXITED(status)) {
+ } else if (WIFEXITED(status) && WEXITSTATUS(status)) {
fprintf(stderr, "%s: '%s' returned %d\n",
__progname, cmd, WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) {
OpenPOWER on IntegriCloud