aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/pkg
diff options
context:
space:
mode:
authorScott Long <scottl@FreeBSD.org>2020-11-15 07:50:29 +0000
committerScott Long <scottl@FreeBSD.org>2020-11-15 07:50:29 +0000
commit1b249101df13bc8cd455a28d5eeb87730fe2c0ae (patch)
tree8dc575f1821d3064471d97d0147e858cc8657e99 /usr.sbin/pkg
parent85a5fe290b4700ad7f4673f653be77bc6ae0a4d0 (diff)
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.
Notes
Notes: svn path=/head/; revision=367702
Diffstat (limited to 'usr.sbin/pkg')
-rw-r--r--usr.sbin/pkg/pkg.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/usr.sbin/pkg/pkg.c b/usr.sbin/pkg/pkg.c
index 057a4236174d..0130e9da83b6 100644
--- a/usr.sbin/pkg/pkg.c
+++ b/usr.sbin/pkg/pkg.c
@@ -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;