summaryrefslogtreecommitdiffstats
path: root/lib/libjail
diff options
context:
space:
mode:
authorjamie <jamie@FreeBSD.org>2010-10-27 21:01:53 +0000
committerjamie <jamie@FreeBSD.org>2010-10-27 21:01:53 +0000
commite7b4c436b0e84b9116c4478f656c25deecf756b1 (patch)
tree5bdc1d732061bb5a87c69f62064ce7d638c8b52d /lib/libjail
parentc138ecb91e7d207c0394f8ecf074053e0ada08d4 (diff)
downloadFreeBSD-src-e7b4c436b0e84b9116c4478f656c25deecf756b1.zip
FreeBSD-src-e7b4c436b0e84b9116c4478f656c25deecf756b1.tar.gz
Find a jail's type as part of jailparam_init rather than waiting until
it's absolutely necessary. MFC after: 1 week
Diffstat (limited to 'lib/libjail')
-rw-r--r--lib/libjail/jail.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/lib/libjail/jail.c b/lib/libjail/jail.c
index 1be8358..99bd970 100644
--- a/lib/libjail/jail.c
+++ b/lib/libjail/jail.c
@@ -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, const char *name)
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, const char *value)
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, unsigned njp, int flags)
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)
OpenPOWER on IntegriCloud