summaryrefslogtreecommitdiff
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
parent991f6e7534a9b1a99b7da711676e6714e2cf6680 (diff)
downloadsrc-test2-56d11d4a3749408b91751f2b1d7082167ae1814d.tar.gz
src-test2-56d11d4a3749408b91751f2b1d7082167ae1814d.zip
Notes
-rw-r--r--sbin/nvmecontrol/comnd.c2
-rw-r--r--sbin/nvmecontrol/nvmecontrol.c5
-rw-r--r--usr.sbin/mailwrapper/mailwrapper.c2
-rw-r--r--usr.sbin/pkg/Makefile2
-rw-r--r--usr.sbin/pkg/config.c6
-rw-r--r--usr.sbin/pkg/pkg.c5
6 files changed, 12 insertions, 10 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);
diff --git a/usr.sbin/mailwrapper/mailwrapper.c b/usr.sbin/mailwrapper/mailwrapper.c
index 8a9ec220a26b..ef9c3b4d55c2 100644
--- a/usr.sbin/mailwrapper/mailwrapper.c
+++ b/usr.sbin/mailwrapper/mailwrapper.c
@@ -106,7 +106,7 @@ main(int argc, char *argv[], char *envp[])
addarg(&al, argv[0]);
snprintf(localmailerconf, MAXPATHLEN, "%s/etc/mail/mailer.conf",
- getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE);
+ getlocalbase());
mailerconf = localmailerconf;
if ((config = fopen(localmailerconf, "r")) == NULL)
diff --git a/usr.sbin/pkg/Makefile b/usr.sbin/pkg/Makefile
index ebfb71c1699b..980faafc6b6c 100644
--- a/usr.sbin/pkg/Makefile
+++ b/usr.sbin/pkg/Makefile
@@ -25,6 +25,6 @@ MAN= pkg.7
CFLAGS+=-I${SRCTOP}/contrib/libucl/include
.PATH: ${SRCTOP}/contrib/libucl/include
-LIBADD= archive fetch ucl sbuf crypto ssl
+LIBADD= archive fetch ucl sbuf crypto ssl util
.include <bsd.prog.mk>
diff --git a/usr.sbin/pkg/config.c b/usr.sbin/pkg/config.c
index a1dba3f2670a..aaa9010b295d 100644
--- a/usr.sbin/pkg/config.c
+++ b/usr.sbin/pkg/config.c
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
#include <ucl.h>
#include <err.h>
#include <errno.h>
+#include <libutil.h>
#include <paths.h>
#include <stdbool.h>
#include <unistd.h>
@@ -455,9 +456,8 @@ config_init(void)
}
/* Read LOCALBASE/etc/pkg.conf first. */
- localbase = getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE;
- snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf",
- localbase);
+ localbase = getlocalbase();
+ snprintf(confpath, sizeof(confpath), "%s/etc/pkg.conf", localbase);
if (access(confpath, F_OK) == 0 && read_conf_file(confpath,
CONFFILE_PKG))
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 3de789328c37..a35efd8f91a8 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -43,12 +43,12 @@ __FBSDID("$FreeBSD$");
#include <errno.h>
#include <fcntl.h>
#include <fetch.h>
+#include <libutil.h>
#include <paths.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <unistd.h>
#include <ucl.h>
#include <openssl/err.h>
@@ -1045,8 +1045,7 @@ main(int argc, char *argv[])
pkgarg = NULL;
yes = false;
- snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg",
- getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE);
+ snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg", getlocalbase());
if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) {
bootstrap_only = true;