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)
Fri, Mar 14, 3:56 PM
Unknown Object (File)
Feb 24 2025, 7:51 PM
Unknown Object (File)
Feb 24 2025, 8:55 AM
Unknown Object (File)
Feb 24 2025, 12:07 AM
Unknown Object (File)
Feb 23 2025, 4:36 PM
Unknown Object (File)
Feb 9 2025, 7:01 PM
Unknown Object (File)
Feb 9 2025, 1:32 AM
Unknown Object (File)
Feb 9 2025, 1:15 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