Page MenuHomeFreeBSD

lib/flua/libjail: Allow empty params table
ClosedPublic

Authored by freqlabs on Feb 18 2021, 6:34 PM.

Details

Summary

The name or jid always gets added to the params, and that's enough to avoid allocating a 0 length params array.

Test Plan
# /usr/libexec/flua -l jail -e 'jail.setparams("myjail", {}, jail.CREATE | jail.ATTACH)' -e 'os.execute("ps ax")'
 PID TT  STAT    TIME COMMAND
2412  2  S+J  0:00.00 /usr/libexec/flua -l jail -e jail.setparams("myjail", {}, jail.CREATE|jail.ATTACH) -e os
2413  2  R+J  0:00.00 ps ax
# /usr/libexec/flua -l jail -l ucl <<EOF
jail.setparams("myjail", {persist="true"}, jail.CREATE)
_, params = jail.getparams("myjail", {})
print(ucl.to_json(params))
jail.setparams("myjail", {persist="false"}, jail.UPDATE)
EOF
{
    "name": "myjail"
}

Diff Detail

Repository
R10 FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.