On Tue, Jul 23, 2019 at 09:58:11 -0400, John Ferlan wrote:
If the dup2 fails, then we aren't going to get the correct
result.
Found by Coverity
Signed-off-by: John Ferlan <jferlan(a)redhat.com>
---
tests/virnetdaemontest.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index eae630a8f1..d0e9f241e3 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -287,10 +287,11 @@ static int testExecRestart(const void *opaque)
* fds 100->103 for something else, which is probably
* fairly reasonable in general
*/
- dup2(fdserver[0], 100);
- dup2(fdserver[1], 101);
- dup2(fdclient[0], 102);
- dup2(fdclient[1], 103);
+ if (dup2(fdserver[0], 100) < 0 ||
+ dup2(fdserver[1], 101) < 0 ||
+ dup2(fdclient[0], 102) < 0 ||
+ dup2(fdclient[1], 103) < 0)
+ goto cleanup;
This will not print any debug message if we hit this.
if (virAsprintf(&infile, "%s/virnetdaemondata/input-data-%s.json",
abs_srcdir, data->jsonfile) < 0)
--
2.20.1
--
libvir-list mailing list
libvir-list(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list