Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 27 Oct 2010 16:35:23 +0000 (UTC)
From:      Jamie Gritton <jamie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r214424 - projects/jailconf/usr.sbin/jail
Message-ID:  <201010271635.o9RGZNAg014369@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jamie
Date: Wed Oct 27 16:35:23 2010
New Revision: 214424
URL: http://svn.freebsd.org/changeset/base/214424

Log:
  Don't assume either jid or name is set - they may not be from the
  command line.

Modified:
  projects/jailconf/usr.sbin/jail/jail.c

Modified: projects/jailconf/usr.sbin/jail/jail.c
==============================================================================
--- projects/jailconf/usr.sbin/jail/jail.c	Wed Oct 27 16:22:54 2010	(r214423)
+++ projects/jailconf/usr.sbin/jail/jail.c	Wed Oct 27 16:35:23 2010	(r214424)
@@ -891,8 +891,7 @@ running_jid(struct cfjail *j, int dflag)
 	char *ep;
 	int jid;
 
-	pval = string_param(j->intparams[KP_JID]);
-	if (pval != NULL) {
+	if ((pval = string_param(j->intparams[KP_JID]))) {
 		if (!(jid = strtol(pval, &ep, 10)) || *ep) {
 			j->jid = -1;
 			return;
@@ -901,13 +900,15 @@ running_jid(struct cfjail *j, int dflag)
 		jiov[0].iov_len = sizeof("jid");
 		jiov[1].iov_base = &jid;
 		jiov[1].iov_len = sizeof(jid);
-	} else {
-		pval = string_param(j->intparams[KP_NAME]);
+	} else if ((pval = string_param(j->intparams[KP_NAME]))) {
 		*(const void **)&jiov[0].iov_base = "name";
 		jiov[0].iov_len = sizeof("name");
 		jiov[1].iov_len = strlen(pval) + 1;
 		jiov[1].iov_base = alloca(jiov[1].iov_len);
 		strcpy(jiov[1].iov_base, pval);
+	} else {
+		j->jid = -1;
+		return;
 	}
 	j->jid = jail_get(jiov, 2, dflag ? JAIL_DYING : 0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010271635.o9RGZNAg014369>