Permalink
Browse files

MFC r253459:

  Use _PATH_DEV (from paths.h) for the "/dev/" string, rather than
  hard-coding it.

Approved by:	re (kib)
Sponsored by:	Intel
  • Loading branch information...
1 parent 38993c2 commit 249b061e35631fbea2dfadf0abaeb7bc2468d8f5 @jimharris jimharris committed Jul 24, 2013
Showing with 4 additions and 2 deletions.
  1. +2 −1 sbin/nvmecontrol/devlist.c
  2. +2 −1 sbin/nvmecontrol/nvmecontrol.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;
@@ -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)

0 comments on commit 249b061

Please sign in to comment.