command: handle empty buffer argument correctly

virBufferContentAndReset (intentionally) returns NULL for a buffer
with no content, but it is feasible to invoke a command with an
explicit empty string.

* src/util/command.c (virCommandAddEnvBuffer): Reject empty string.
(virCommandAddArgBuffer): Allow explicit empty argument.
* tests/commandtest.c (test9): Test it.
* tests/commanddata/test9.log: Adjust.
This commit is contained in:
Eric Blake
2011-11-09 17:19:33 -07:00
parent c74a2a03f0
commit 2b045d39df
3 changed files with 27 additions and 3 deletions

View File

@@ -2,8 +2,10 @@ ARG:-version
ARG:-log=bar.log
ARG:arg1
ARG:arg2
ARG:arg3
ARG:
ARG:arg4
ARG:arg5
ARG:arg6
ENV:DISPLAY=:0.0
ENV:HOME=/home/test
ENV:HOSTNAME=test