From owner-svn-src-head@freebsd.org Sun Nov 15 07:50:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9EEA2D6937; Sun, 15 Nov 2020 07:50:30 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CYks24T0pz3GWh; Sun, 15 Nov 2020 07:50:30 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C1F418252; Sun, 15 Nov 2020 07:50:30 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AF7oUUe017063; Sun, 15 Nov 2020 07:50:30 GMT (envelope-from scottl@FreeBSD.org) Received: (from scottl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AF7oUMx017060; Sun, 15 Nov 2020 07:50:30 GMT (envelope-from scottl@FreeBSD.org) Message-Id: <202011150750.0AF7oUMx017060@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: scottl set sender to scottl@FreeBSD.org using -f From: Scott Long Date: Sun, 15 Nov 2020 07:50:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r367702 - in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: scottl X-SVN-Commit-Paths: in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg X-SVN-Commit-Revision: 367702 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 15 Nov 2020 07:50:30 -0000 Author: scottl Date: Sun Nov 15 07:50:29 2020 New Revision: 367702 URL: https://svnweb.freebsd.org/changeset/base/367702 Log: 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. Modified: head/sbin/nvmecontrol/nvmecontrol.c head/usr.sbin/mailwrapper/mailwrapper.c head/usr.sbin/pkg/pkg.c Modified: head/sbin/nvmecontrol/nvmecontrol.c ============================================================================== --- head/sbin/nvmecontrol/nvmecontrol.c Sun Nov 15 07:48:52 2020 (r367701) +++ head/sbin/nvmecontrol/nvmecontrol.c Sun Nov 15 07:50:29 2020 (r367702) @@ -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); } Modified: head/usr.sbin/mailwrapper/mailwrapper.c ============================================================================== --- head/usr.sbin/mailwrapper/mailwrapper.c Sun Nov 15 07:48:52 2020 (r367701) +++ head/usr.sbin/mailwrapper/mailwrapper.c Sun Nov 15 07:50:29 2020 (r367702) @@ -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) Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Sun Nov 15 07:48:52 2020 (r367701) +++ head/usr.sbin/pkg/pkg.c Sun Nov 15 07:50:29 2020 (r367702) @@ -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;