diff options
author | jimharris <jimharris@FreeBSD.org> | 2013-07-09 21:14:15 +0000 |
---|---|---|
committer | jimharris <jimharris@FreeBSD.org> | 2013-07-09 21:14:15 +0000 |
commit | 7ed5b42834802b6170f1ef289f5ee704ff41c093 (patch) | |
tree | db3f599ebf7e977e55a50250293baa33bd3a0732 /sbin/nvmecontrol/reset.c | |
parent | 1dabbdc24cf70442290ab582551237bf8ee37175 (diff) | |
download | FreeBSD-src-7ed5b42834802b6170f1ef289f5ee704ff41c093.zip FreeBSD-src-7ed5b42834802b6170f1ef289f5ee704ff41c093.tar.gz |
Incorporate feedback from bde@ based on r252672 changes:
* Use 0/1 instead of sysexits. Man pages are confusing on this topic,
but 0/1 is sufficient for nvmecontrol.
* Use err function family where possible instead of fprintf/exit.
* Fix some typing errors.
* Clean up some error message inconsistencies.
Sponsored by: Intel
Submitted by: bde (parts of firmware.c changes)
MFC after: 3 days
Diffstat (limited to 'sbin/nvmecontrol/reset.c')
-rw-r--r-- | sbin/nvmecontrol/reset.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sbin/nvmecontrol/reset.c b/sbin/nvmecontrol/reset.c index a96722c..8ce597e 100644 --- a/sbin/nvmecontrol/reset.c +++ b/sbin/nvmecontrol/reset.c @@ -30,12 +30,11 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/ioccom.h> -#include <errno.h> +#include <err.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <sysexits.h> #include <unistd.h> #include "nvmecontrol.h" @@ -45,7 +44,7 @@ reset_usage(void) { fprintf(stderr, "usage:\n"); fprintf(stderr, RESET_USAGE); - exit(EX_USAGE); + exit(1); } void @@ -65,11 +64,8 @@ reset(int argc, char *argv[]) reset_usage(); open_dev(argv[optind], &fd, 1, 1); - if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) { - printf("Reset request to %s failed. errno=%d (%s)\n", - argv[optind], errno, strerror(errno)); - exit(EX_IOERR); - } + if (ioctl(fd, NVME_RESET_CONTROLLER) < 0) + err(1, "reset request to %s failed", argv[optind]); - exit(EX_OK); + exit(0); } |