]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: avoid close of bad file handle in commandtest
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 21 Sep 2020 17:37:03 +0000 (18:37 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Tue, 22 Sep 2020 09:45:59 +0000 (10:45 +0100)
Closed file handles need to be initialized to -1, not 0. This caused a
inappropriate double close of stdin, which is not desirable, although
it had no ill effects.

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/commandtest.c

index 42225a8ef204212442d65b1e62b6679bacb77495..cbbcda4e5f1471d65cf9bef246d47bd3fd93e3a3 100644 (file)
@@ -1091,8 +1091,8 @@ static int test27(const void *unused G_GNUC_UNUSED)
         printf("Could not set send buffers\n");
         goto cleanup;
     }
-    pipe1[1] = 0;
-    pipe2[1] = 0;
+    pipe1[1] = -1;
+    pipe2[1] = -1;
     buffer1 = NULL;
     buffer2 = NULL;