Date: Wed, 27 Oct 2010 21:01:53 +0000 (UTC) From: Jamie Gritton <jamie@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r214434 - head/lib/libjail Message-ID: <201010272101.o9RL1rF4031714@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jamie Date: Wed Oct 27 21:01:53 2010 New Revision: 214434 URL: http://svn.freebsd.org/changeset/base/214434 Log: Find a jail's type as part of jailparam_init rather than waiting until it's absolutely necessary. MFC after: 1 week Modified: head/lib/libjail/jail.c Modified: head/lib/libjail/jail.c ============================================================================== --- head/lib/libjail/jail.c Wed Oct 27 20:25:55 2010 (r214433) +++ head/lib/libjail/jail.c Wed Oct 27 21:01:53 2010 (r214434) @@ -250,10 +250,6 @@ jailparam_all(struct jailparam **jpp) } if (jailparam_init(jp + njp, buf + sizeof(SJPARAM)) < 0) goto error; - if (jailparam_type(jp + njp) < 0) { - njp++; - goto error; - } mib1[1] = 2; } jp = realloc(jp, njp * sizeof(*jp)); @@ -279,6 +275,10 @@ jailparam_init(struct jailparam *jp, con strerror_r(errno, jail_errmsg, JAIL_ERRMSGLEN); return (-1); } + if (jailparam_type(jp) < 0) { + jailparam_free(jp, 1); + return (-1); + } return (0); } @@ -293,8 +293,6 @@ jailparam_import(struct jailparam *jp, c const char *avalue; int i, nval, fw; - if (!jp->jp_ctltype && jailparam_type(jp) < 0) - return (-1); if (value == NULL) return (0); if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { @@ -563,8 +561,6 @@ jailparam_get(struct jailparam *jp, unsi jp_lastjid = jp_jid = jp_name = NULL; arrays = 0; for (ai = j = 0; j < njp; j++) { - if (!jp[j].jp_ctltype && jailparam_type(jp + j) < 0) - return (-1); if (!strcmp(jp[j].jp_name, "lastjid")) jp_lastjid = jp + j; else if (!strcmp(jp[j].jp_name, "jid")) @@ -725,8 +721,6 @@ jailparam_export(struct jailparam *jp) int i, nval, ival; char valbuf[INET6_ADDRSTRLEN]; - if (!jp->jp_ctltype && jailparam_type(jp) < 0) - return (NULL); if ((jp->jp_ctltype & CTLTYPE) == CTLTYPE_STRING) { value = strdup(jp->jp_value); if (value == NULL)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010272101.o9RL1rF4031714>