Find a jail's type as part of jailparam_init rather than waiting until
it's absolutely necessary. MFC after: 1 week
This commit is contained in:
parent
c138ecb91e
commit
e7b4c436b0
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user