]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virCommandSetSendBuffer: Provide saner semantics
authorPeter Krempa <pkrempa@redhat.com>
Mon, 1 Mar 2021 10:04:54 +0000 (11:04 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 5 Mar 2021 14:33:34 +0000 (15:33 +0100)
commitef4c325f25c59b4922cab5b045091d09a5b94635
tree6185457ccbece25d7dcbfed2c2a2a5d3ca43a954
parentaa5c57b407c8652d04e35252e92d009b642b46d6
virCommandSetSendBuffer: Provide saner semantics

The function is used to automatically feed a buffer into a pipe which
can be used by the command to read contents of the buffer.

Rather than passing in a pipe, let's create the pipe inside
virCommandSetSendBuffer and directly associate the reader end with the
command. This way the ownership of both ends of the pipe will end up
with the virCommand right away reducing the need of cleanup in callers.

The returned value then can be used just to format the appropriate
arguments without worrying about cleanup or failure.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/qemu/qemu_tpm.c
src/util/vircommand.c
src/util/vircommand.h
tests/commandtest.c