svn commit: r367702 - in head: sbin/nvmecontrol usr.sbin/mailwrapper usr.sbin/pkg

Scott Long scottl at FreeBSD.org
Sun Nov 15 07:50:30 UTC 2020


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;


More information about the svn-src-head mailing list