Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107493719
D27237.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D27237.diff
View Options
Index: head/sbin/nvmecontrol/comnd.c
===================================================================
--- head/sbin/nvmecontrol/comnd.c
+++ head/sbin/nvmecontrol/comnd.c
@@ -287,7 +287,7 @@
* 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;
Index: head/sbin/nvmecontrol/nvmecontrol.c
===================================================================
--- head/sbin/nvmecontrol/nvmecontrol.c
+++ head/sbin/nvmecontrol/nvmecontrol.c
@@ -38,6 +38,7 @@
#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 @@
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);
Index: head/usr.sbin/mailwrapper/mailwrapper.c
===================================================================
--- head/usr.sbin/mailwrapper/mailwrapper.c
+++ head/usr.sbin/mailwrapper/mailwrapper.c
@@ -106,7 +106,7 @@
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)
Index: head/usr.sbin/pkg/Makefile
===================================================================
--- head/usr.sbin/pkg/Makefile
+++ head/usr.sbin/pkg/Makefile
@@ -25,6 +25,6 @@
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>
Index: head/usr.sbin/pkg/config.c
===================================================================
--- head/usr.sbin/pkg/config.c
+++ head/usr.sbin/pkg/config.c
@@ -40,6 +40,7 @@
#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 @@
}
/* 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))
Index: head/usr.sbin/pkg/pkg.c
===================================================================
--- head/usr.sbin/pkg/pkg.c
+++ head/usr.sbin/pkg/pkg.c
@@ -43,12 +43,12 @@
#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 @@
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;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Jan 15, 11:51 PM (17 h, 15 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15817476
Default Alt Text
D27237.diff (3 KB)
Attached To
Mode
D27237: Use getlocalbase() in a few base system programs
Attached
Detach File
Event Timeline
Log In to Comment