From: Ján Tomko Date: Tue, 10 Apr 2018 08:14:02 +0000 (+0200) Subject: Introduce qemuBuildSeccompSandboxCommandLine X-Git-Tag: v4.3.0-rc1~218 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ee0ea8b12d4d794bfc0b9aa3385b4ab49e7e21d1;p=thirdparty%2Flibvirt.git Introduce qemuBuildSeccompSandboxCommandLine Move the building of -sandbox command line into a separate function. Signed-off-by: Ján Tomko Reviewed-by: John Ferlan Reviewed-by: Daniel P. Berrangé --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index a1a9e91e49..ea0dc6f183 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -9724,6 +9724,21 @@ qemuBuildCommandLineValidate(virQEMUDriverPtr driver, } +static int +qemuBuildSeccompSandboxCommandLine(virCommandPtr cmd, + virQEMUDriverConfigPtr cfg, + virQEMUCapsPtr qemuCaps ATTRIBUTE_UNUSED) +{ + if (cfg->seccompSandbox == 0) + virCommandAddArgList(cmd, "-sandbox", "off", NULL); + else if (cfg->seccompSandbox > 0) + virCommandAddArgList(cmd, "-sandbox", "on", NULL); + + return 0; + +} + + /* * Constructs a argv suitable for launching qemu with config defined * for a given virtual machine. @@ -9954,10 +9969,8 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, ? qemucmd->env_value[i] : ""); } - if (cfg->seccompSandbox == 0) - virCommandAddArgList(cmd, "-sandbox", "off", NULL); - else if (cfg->seccompSandbox > 0) - virCommandAddArgList(cmd, "-sandbox", "on", NULL); + if (qemuBuildSeccompSandboxCommandLine(cmd, cfg, qemuCaps) < 0) + goto error; if (qemuBuildPanicCommandLine(cmd, def, qemuCaps) < 0) goto error;