bectl(8): Address Coverity complaints

CID 1400451: case 0 is missing a break/return and falling through to the
default case.  waitpid(0, ...) makes little sense in the child, we likely
wanted to terminate immediately.

CID 1400453: size argument uses sizeof(char **) instead of sizeof(char *)
and is assigned to a char **; sizeof's match but "this isn't a portable
assumption".

CID:	1400451, 1400453
MFC after:	3 days
This commit is contained in:
Kyle Evans 2019-05-28 16:12:16 +00:00
parent 1c76d3a9fb
commit 515fa27bb0
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=348328

View File

@ -155,7 +155,7 @@ build_jailcmd(char ***argvp, bool interactive, int argc, char *argv[])
nargv += argc;
}
jargv = *argvp = calloc(nargv, sizeof(jargv));
jargv = *argvp = calloc(nargv, sizeof(*jargv));
if (jargv == NULL)
err(2, "calloc");
@ -346,6 +346,7 @@ bectl_cmd_jail(int argc, char *argv[])
case 0:
execv("/usr/sbin/jail", jargv);
fprintf(stderr, "bectl jail: failed to execute\n");
return (1);
default:
waitpid(pid, NULL, 0);
}