[PATCH v1] util: vircommand: fix redundant if

Martin Kletzander mkletzan at redhat.com
Tue Oct 10 10:37:15 UTC 2023


On Tue, Oct 10, 2023 at 11:54:14AM +0300, Dmitry Frolov wrote:
>Comparisson "if(ret == -1)" is always false.

s/ss/s/

Fixed locally and

Reviewed-by: Martin Kletzander <mkletzan at redhat.com>

I'll push it in a while.  Thanks for the patch.

>This statement was forgotten during switching to g_new0()
>
>Found by Linux Verification Center (linuxtesting.org) with SVACE.
>
>Fixes: 0275b06a55fc7b1ec6a9e93f7fb73bea7388f634 ("util: command: use g_new0")
>Signed-off-by: Dmitry Frolov <frolov at swemel.ru>
>---
> src/util/vircommand.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
>diff --git a/src/util/vircommand.c b/src/util/vircommand.c
>index 9d4ba1e97c..81e74deee0 100644
>--- a/src/util/vircommand.c
>+++ b/src/util/vircommand.c
>@@ -2227,7 +2227,7 @@ virCommandProcessIO(virCommand *cmd)
>     int outfd = -1, errfd = -1;
>     size_t inlen = 0, outlen = 0, errlen = 0;
>     size_t inoff = 0;
>-    int ret = 0;
>+    int ret = -1;
>     g_autofree struct pollfd *fds = NULL;
>
>     if (dryRunBuffer || dryRunCallback) {
>@@ -2254,9 +2254,6 @@ virCommandProcessIO(virCommand *cmd)
>         VIR_FREE(*cmd->errbuf);
>         *cmd->errbuf = g_new0(char, 1);
>     }
>-    if (ret == -1)
>-        goto cleanup;
>-    ret = -1;
>
>     fds = g_new0(struct pollfd, 3 + virCommandGetNumSendBuffers(cmd));
>
>-- 
>2.34.1
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20231010/3ccf7649/attachment.sig>


More information about the libvir-list mailing list