Page MenuHomeFreeBSD

lib/flua/libjail: Allow empty params table
ClosedPublic

Authored by freqlabs on Feb 18 2021, 6:34 PM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, Dec 4, 9:39 AM
Unknown Object (File)
Mon, Nov 25, 12:00 AM
Unknown Object (File)
Nov 4 2024, 1:15 AM
Unknown Object (File)
Nov 4 2024, 1:15 AM
Unknown Object (File)
Nov 4 2024, 1:15 AM
Unknown Object (File)
Nov 4 2024, 12:55 AM
Unknown Object (File)
Oct 2 2024, 2:33 PM
Unknown Object (File)
Oct 2 2024, 10:16 AM
Subscribers
None

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
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable