Fix the previous revision, it suffered from an incomplete change to the

getlocalbase API.  Also don't erroneously subtract the lenth from the
buffer a second time.
This commit is contained in:
Scott Long 2020-11-15 07:50:29 +00:00
parent 85a5fe290b
commit 1b249101df
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=367702
3 changed files with 5 additions and 5 deletions

View File

@ -187,7 +187,7 @@ main(int argc, char *argv[])
snprintf(locallib, MAXPATHLEN, "/lib/nvmecontrol");
cmd_load_dir(locallib, NULL, NULL);
if ((len = getlocalbase(locallib, MAXPATHLEN)) > 0) {
strlcat(locallib, "/lib/nvmecontrol", MAXPATHLEN - len);
strlcat(locallib, "/lib/nvmecontrol", MAXPATHLEN);
cmd_load_dir(locallib, NULL, NULL);
}

View File

@ -105,10 +105,10 @@ main(int argc, char *argv[], char *envp[])
initarg(&al);
addarg(&al, argv[0]);
if ((len = getlocalbase(localmailerconf, MAXPATHLEN)) != 0)
if ((len = getlocalbase(localmailerconf, MAXPATHLEN)) <= 0)
err(EX_OSERR, "cannot determine local path");
strlcat(localmailerconf, "/etc/mail/mailer.conf", MAXPATHLEN - len);
strlcat(localmailerconf, "/etc/mail/mailer.conf", MAXPATHLEN);
mailerconf = localmailerconf;
if ((config = fopen(localmailerconf, "r")) == NULL)

View File

@ -1047,11 +1047,11 @@ main(int argc, char *argv[])
pkgarg = NULL;
yes = false;
if ((len = getlocalbase(pkgpath, MAXPATHLEN)) != 0) {
if ((len = getlocalbase(pkgpath, MAXPATHLEN)) <= 0) {
fprintf(stderr, "Cannot determine local path\n");
exit(EXIT_FAILURE);
}
strlcat(pkgpath, "/sbin/pkg", MAXPATHLEN - len);
strlcat(pkgpath, "/sbin/pkg", MAXPATHLEN);
if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) {
bootstrap_only = true;