Skip to content

Commit

Permalink
Use _PATH_DEV (from paths.h) for the "/dev/" string, rather than
Browse files Browse the repository at this point in the history
hard-coding it.

Sponsored by:	Intel
Suggested by:	kib
Reviewed by:	kib, carl
MFC after:	3 days
  • Loading branch information
jimharris committed Jul 18, 2013
1 parent 3e18e4f commit 1b0750b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion sbin/nvmecontrol/devlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion sbin/nvmecontrol/nvmecontrol.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 1b0750b

Please sign in to comment.