svn commit: r367687 - in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg
Scott Long
scottl at samsco.org
Sun Nov 15 18:16:38 UTC 2020
I fixed this in r367702, sorry for the breakage.
Scott
> On Nov 15, 2020, at 11:12 AM, Brandon Bergren <bdragon at FreeBSD.org> wrote:
>
>> --- head/usr.sbin/pkg/pkg.c Sat Nov 14 17:57:50 2020 (r367686)
>> +++ head/usr.sbin/pkg/pkg.c Sat Nov 14 18:01:14 2020 (r367687)
>> @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
>> #include <errno.h>
>> #include <fcntl.h>
>> #include <fetch.h>
>> +#include <libutil.h>
>> #include <paths.h>
>> #include <stdbool.h>
>> #include <stdlib.h>
>> @@ -1037,6 +1038,7 @@ main(int argc, char *argv[])
>> {
>> char pkgpath[MAXPATHLEN];
>> const char *pkgarg;
>> + size_t len;
>> int i;
>> bool bootstrap_only, force, yes;
>>
>> @@ -1045,8 +1047,11 @@ main(int argc, char *argv[])
>> pkgarg = NULL;
>> yes = false;
>>
>> - snprintf(pkgpath, MAXPATHLEN, "%s/sbin/pkg",
>> - getenv("LOCALBASE") ? getenv("LOCALBASE") : _PATH_LOCALBASE);
>> + if ((len = getlocalbase(pkgpath, MAXPATHLEN)) != 0) {
>> + fprintf(stderr, "Cannot determine local path\n");
>> + exit(EXIT_FAILURE);
>> + }
>
> This logic is broken, it is failing on kernels that DO have user.localbase.
>
>> + strlcat(pkgpath, "/sbin/pkg", MAXPATHLEN - len);
>>
>> if (argc > 1 && strcmp(argv[1], "bootstrap") == 0) {
>> bootstrap_only = true;
>>
>
> --
> Brandon Bergren
> bdragon at FreeBSD.org
More information about the svn-src-all
mailing list