Don't ignore allocation failure in virCommandAddEnvPassCommon
The virCommandAddEnvPassCommon method ignored the failure to pre-allocate the env variable array with VIR_RESIZE_N. While this is harmless, it confuses the test harness which is trying to validate OOM handling of every individual allocation call. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
ecd2ba6893
commit
6912cf4faa
@ -1279,9 +1279,10 @@ virCommandAddEnvPassCommon(virCommandPtr cmd)
|
|||||||
if (!cmd || cmd->has_error)
|
if (!cmd || cmd->has_error)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Attempt to Pre-allocate; allocation failure will be detected
|
if (VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 9) < 0) {
|
||||||
* later during virCommandAdd*. */
|
cmd->has_error = ENOMEM;
|
||||||
ignore_value(VIR_RESIZE_N(cmd->env, cmd->maxenv, cmd->nenv, 9));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
virCommandAddEnvPair(cmd, "LC_ALL", "C");
|
virCommandAddEnvPair(cmd, "LC_ALL", "C");
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user