Author: kevans
Date: Tue May 28 16:12:16 2019
New Revision: 348328
URL: https://svnweb.freebsd.org/changeset/base/348328

Log:
  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

Modified:
  head/sbin/bectl/bectl_jail.c

Modified: head/sbin/bectl/bectl_jail.c
==============================================================================
--- head/sbin/bectl/bectl_jail.c        Tue May 28 15:47:00 2019        
(r348327)
+++ head/sbin/bectl/bectl_jail.c        Tue May 28 16:12:16 2019        
(r348328)
@@ -155,7 +155,7 @@ build_jailcmd(char ***argvp, bool interactive, int arg
                        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);
        }
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to