aboutsummaryrefslogtreecommitdiff
path: root/sbin/nvmecontrol/reset.c
diff options
context:
space:
mode:
authorJim Harris <jimharris@FreeBSD.org>2013-07-09 21:14:15 +0000
committerJim Harris <jimharris@FreeBSD.org>2013-07-09 21:14:15 +0000
commit821ef73ca6b9cc9cf62233875197dd2177ba37cd (patch)
treedb3f599ebf7e977e55a50250293baa33bd3a0732 /sbin/nvmecontrol/reset.c
parentec526ea90bcf5b65527c5204a6fdcd1ae4957ca8 (diff)
downloadsrc-821ef73ca6b9cc9cf62233875197dd2177ba37cd.tar.gz
src-821ef73ca6b9cc9cf62233875197dd2177ba37cd.zip
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
Notes
Notes: svn path=/head/; revision=253109
Diffstat (limited to 'sbin/nvmecontrol/reset.c')
-rw-r--r--sbin/nvmecontrol/reset.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/sbin/nvmecontrol/reset.c b/sbin/nvmecontrol/reset.c
index a96722c31470..8ce597ea1a17 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);
}