svn commit: r366856 - stable/12/sbin/nvmecontrol

Alexander Motin mav at FreeBSD.org
Mon Oct 19 20:37:05 UTC 2020


Author: mav
Date: Mon Oct 19 20:37:04 2020
New Revision: 366856
URL: https://svnweb.freebsd.org/changeset/base/366856

Log:
  MFC r352212 (by imp):
  Assume all the short args have optional args so allocate space for the
  ':'. It's slightly wasteful, but much easier (and the savings in bytes
  at runtime would be tiny, but the code to do it larger).

Modified:
  stable/12/sbin/nvmecontrol/comnd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sbin/nvmecontrol/comnd.c
==============================================================================
--- stable/12/sbin/nvmecontrol/comnd.c	Mon Oct 19 20:26:37 2020	(r366855)
+++ stable/12/sbin/nvmecontrol/comnd.c	Mon Oct 19 20:37:04 2020	(r366856)
@@ -189,7 +189,7 @@ arg_parse(int argc, char * const * argv, const struct 
 	lopts = malloc((n + 2) * sizeof(struct option));
 	if (lopts == NULL)
 		err(1, "option memory");
-	p = shortopts = malloc((n + 3) * sizeof(char));
+	p = shortopts = malloc((2 * n + 3) * sizeof(char));
 	if (shortopts == NULL)
 		err(1, "shortopts memory");
 	idx = 0;


More information about the svn-src-all mailing list