svn commit: r253459 - head/sbin/nvmecontrol
Jim Harris
jimharris at FreeBSD.org
Thu Jul 18 23:25:57 UTC 2013
Author: jimharris
Date: Thu Jul 18 23:25:57 2013
New Revision: 253459
URL: http://svnweb.freebsd.org/changeset/base/253459
Log:
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
Modified:
head/sbin/nvmecontrol/devlist.c
head/sbin/nvmecontrol/nvmecontrol.c
Modified: head/sbin/nvmecontrol/devlist.c
==============================================================================
--- head/sbin/nvmecontrol/devlist.c Thu Jul 18 23:12:44 2013 (r253458)
+++ head/sbin/nvmecontrol/devlist.c Thu Jul 18 23:25:57 2013 (r253459)
@@ -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;
Modified: head/sbin/nvmecontrol/nvmecontrol.c
==============================================================================
--- head/sbin/nvmecontrol/nvmecontrol.c Thu Jul 18 23:12:44 2013 (r253458)
+++ head/sbin/nvmecontrol/nvmecontrol.c Thu Jul 18 23:25:57 2013 (r253459)
@@ -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 s
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)
More information about the svn-src-head
mailing list