summaryrefslogtreecommitdiffstats
path: root/sbin/nvmecontrol
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2013-07-18 23:25:57 +0000
committerjimharris <jimharris@FreeBSD.org>2013-07-18 23:25:57 +0000
commit1b0750b86c77afe56bc851b72ab13a0d7536d066 (patch)
tree70966c82b5117cd1c459142a0f772448f54bd15b /sbin/nvmecontrol
parent3e18e4fbf6a97737356dbbed8ef7bbdb2e644b0b (diff)
downloadFreeBSD-src-1b0750b86c77afe56bc851b72ab13a0d7536d066.zip
FreeBSD-src-1b0750b86c77afe56bc851b72ab13a0d7536d066.tar.gz
Use _PATH_DEV (from paths.h) for the "/dev/" string, rather than
hard-coding it. Sponsored by: Intel Suggested by: kib Reviewed by: kib, carl MFC after: 3 days
Diffstat (limited to 'sbin/nvmecontrol')
-rw-r--r--sbin/nvmecontrol/devlist.c3
-rw-r--r--sbin/nvmecontrol/nvmecontrol.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/sbin/nvmecontrol/devlist.c b/sbin/nvmecontrol/devlist.c
index 2a95832..29c0475 100644
--- a/sbin/nvmecontrol/devlist.c
+++ b/sbin/nvmecontrol/devlist.c
@@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <paths.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
@@ -82,7 +83,7 @@ devlist(int argc, char *argv[])
if (ret != 0) {
if (ret == EACCES) {
- warnx("could not open /dev/%s\n", name);
+ warnx("could not open "_PATH_DEV"%s\n", name);
continue;
} else
break;
diff --git a/sbin/nvmecontrol/nvmecontrol.c b/sbin/nvmecontrol/nvmecontrol.c
index 333bb62..4dee190 100644
--- a/sbin/nvmecontrol/nvmecontrol.c
+++ b/sbin/nvmecontrol/nvmecontrol.c
@@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <paths.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdio.h>
@@ -175,7 +176,7 @@ open_dev(const char *str, int *fd, int show_error, int exit_on_error)
return (EINVAL);
}
- snprintf(full_path, sizeof(full_path), "/dev/%s", str);
+ snprintf(full_path, sizeof(full_path), _PATH_DEV"%s", str);
*fd = open(full_path, O_RDWR);
if (*fd < 0) {
if (show_error)
OpenPOWER on IntegriCloud