summaryrefslogtreecommitdiff
path: root/sbin
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-11-18 20:00:55 +0000
committerStefan Eßer <se@FreeBSD.org>2020-11-18 20:00:55 +0000
commit56d11d4a3749408b91751f2b1d7082167ae1814d (patch)
treec3ee43806a81013696621eae845c7cb803eb2d91 /sbin
parent991f6e7534a9b1a99b7da711676e6714e2cf6680 (diff)
downloadsrc-test2-56d11d4a3749408b91751f2b1d7082167ae1814d.tar.gz
src-test2-56d11d4a3749408b91751f2b1d7082167ae1814d.zip
Make use of the getlocalbase() function for run-time adjustment of the
local software base directory, as committed in SVN rev. 367813. The pkg and mailwrapper programs used the LOCALBASE environment variable for this purpose and this functionality is preserved by getlocalbase(). After this change, the value of the user.localbase sysctl variable is used if present (and not overridden in the environment). The nvmecontrol program gains support of a dynamic path to its plugin directory with this update. Differential Revision: https://reviews.freebsd.org/D27237
Notes
Notes: svn path=/head/; revision=367816
Diffstat (limited to 'sbin')
-rw-r--r--sbin/nvmecontrol/comnd.c2
-rw-r--r--sbin/nvmecontrol/nvmecontrol.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/sbin/nvmecontrol/comnd.c b/sbin/nvmecontrol/comnd.c
index b8c9abc86844..0c53c54b9818 100644
--- a/sbin/nvmecontrol/comnd.c
+++ b/sbin/nvmecontrol/comnd.c
@@ -287,7 +287,7 @@ bad_arg:
* Loads all the .so's from the specified directory.
*/
void
-cmd_load_dir(const char *dir __unused, cmd_load_cb_t cb __unused, void *argp __unused)
+cmd_load_dir(const char *dir, cmd_load_cb_t cb, void *argp)
{
DIR *d;
struct dirent *dent;
diff --git a/sbin/nvmecontrol/nvmecontrol.c b/sbin/nvmecontrol/nvmecontrol.c
index 758822f2e25a..68a2ecb9b0b8 100644
--- a/sbin/nvmecontrol/nvmecontrol.c
+++ b/sbin/nvmecontrol/nvmecontrol.c
@@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$");
#include <err.h>
#include <errno.h>
#include <fcntl.h>
+#include <libutil.h>
#include <paths.h>
#include <stdbool.h>
#include <stddef.h>
@@ -178,11 +179,13 @@ get_nsid(int fd, char **ctrlr_str, uint32_t *nsid)
int
main(int argc, char *argv[])
{
+ static char dir[MAXPATHLEN];
cmd_init();
cmd_load_dir("/lib/nvmecontrol", NULL, NULL);
- cmd_load_dir(_PATH_LOCALBASE "/lib/nvmecontrol", NULL, NULL);
+ snprintf(dir, MAXPATHLEN, "%s/lib/nvmecontrol", getlocalbase());
+ cmd_load_dir(dir, NULL, NULL);
cmd_dispatch(argc, argv, NULL);