On a Tuesday in 2021, Peter Krempa wrote:
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 <[email protected]>
---
src/qemu/qemu_tpm.c   | 50 +++++++++----------------------------------
src/util/vircommand.c | 39 ++++++++++++++++++++++-----------
src/util/vircommand.h |  6 +++---
tests/commandtest.c   | 32 ++++++---------------------
4 files changed, 46 insertions(+), 81 deletions(-)


Reviewed-by: Ján Tomko <[email protected]>

Jano

Attachment: signature.asc
Description: PGP signature

Reply via email to