mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
tests: commandtest: use VIR_AUTOCLOSE
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Laine Stump <laine@redhat.com>
This commit is contained in:
parent
e2929598db
commit
dac017862b
@ -173,8 +173,8 @@ static int test2(const void *unused G_GNUC_UNUSED)
|
|||||||
static int test3(const void *unused G_GNUC_UNUSED)
|
static int test3(const void *unused G_GNUC_UNUSED)
|
||||||
{
|
{
|
||||||
g_autoptr(virCommand) cmd = virCommandNew(abs_builddir "/commandhelper");
|
g_autoptr(virCommand) cmd = virCommandNew(abs_builddir "/commandhelper");
|
||||||
int newfd1 = dup(STDERR_FILENO);
|
VIR_AUTOCLOSE newfd1 = dup(STDERR_FILENO);
|
||||||
int newfd2 = dup(STDERR_FILENO);
|
VIR_AUTOCLOSE newfd2 = dup(STDERR_FILENO);
|
||||||
int newfd3 = dup(STDERR_FILENO);
|
int newfd3 = dup(STDERR_FILENO);
|
||||||
struct stat before, after;
|
struct stat before, after;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
@ -218,9 +218,6 @@ static int test3(const void *unused G_GNUC_UNUSED)
|
|||||||
ret = checkoutput("test3");
|
ret = checkoutput("test3");
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
/* coverity[double_close] */
|
|
||||||
VIR_FORCE_CLOSE(newfd1);
|
|
||||||
VIR_FORCE_CLOSE(newfd2);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -580,7 +577,7 @@ static int test16(const void *unused G_GNUC_UNUSED)
|
|||||||
g_autofree char *outactual = NULL;
|
g_autofree char *outactual = NULL;
|
||||||
const char *outexpect = "A=B C='D E' true F 'G H'";
|
const char *outexpect = "A=B C='D E' true F 'G H'";
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int fd = -1;
|
VIR_AUTOCLOSE fd = -1;
|
||||||
|
|
||||||
virCommandAddEnvPair(cmd, "A", "B");
|
virCommandAddEnvPair(cmd, "A", "B");
|
||||||
virCommandAddEnvPair(cmd, "C", "D E");
|
virCommandAddEnvPair(cmd, "C", "D E");
|
||||||
@ -610,7 +607,6 @@ static int test16(const void *unused G_GNUC_UNUSED)
|
|||||||
ret = checkoutput("test16");
|
ret = checkoutput("test16");
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_CLOSE(fd);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1039,7 +1035,7 @@ static int test26(const void *unused G_GNUC_UNUSED)
|
|||||||
"wallop";
|
"wallop";
|
||||||
|
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
int fd = -1;
|
VIR_AUTOCLOSE fd = -1;
|
||||||
|
|
||||||
virCommandAddEnvPair(cmd, "A", "B");
|
virCommandAddEnvPair(cmd, "A", "B");
|
||||||
virCommandAddEnvPair(cmd, "C", "D E");
|
virCommandAddEnvPair(cmd, "C", "D E");
|
||||||
@ -1071,7 +1067,6 @@ static int test26(const void *unused G_GNUC_UNUSED)
|
|||||||
ret = checkoutput("test26");
|
ret = checkoutput("test26");
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
VIR_FORCE_CLOSE(fd);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user