]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Make it easier to debug tests running programs
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 6 Jul 2009 14:03:31 +0000 (15:03 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 8 Jul 2009 12:40:32 +0000 (13:40 +0100)
* tests/testutils.c: Don't discard stderr when running
external programs during tests

tests/testutils.c

index 2477fe256b9412ac16d384436f7bab69a372a993..7a1dbdcdd8edec7d744cddb111a7a799316c2ce6 100644 (file)
@@ -156,7 +156,6 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
     int i;
     int open_max;
     int stdinfd = -1;
-    int stderrfd = -1;
     const char *const env[] = {
         "LANG=C",
 #if WITH_DRIVER_MODULES
@@ -167,13 +166,10 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
 
     if ((stdinfd = open("/dev/null", O_RDONLY)) < 0)
         goto cleanup;
-    if ((stderrfd = open("/dev/null", O_WRONLY)) < 0)
-        goto cleanup;
 
     open_max = sysconf (_SC_OPEN_MAX);
     for (i = 0; i < open_max; i++) {
         if (i != stdinfd &&
-            i != stderrfd &&
             i != pipefd)
             close(i);
     }
@@ -182,7 +178,7 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
         goto cleanup;
     if (dup2(pipefd, STDOUT_FILENO) != STDOUT_FILENO)
         goto cleanup;
-    if (dup2(stderrfd, STDERR_FILENO) != STDERR_FILENO)
+    if (dup2(pipefd, STDERR_FILENO) != STDERR_FILENO)
         goto cleanup;
 
     /* SUS is crazy here, hence the cast */
@@ -191,8 +187,6 @@ void virtTestCaptureProgramExecChild(const char *const argv[],
  cleanup:
     if (stdinfd != -1)
         close(stdinfd);
-    if (stderrfd != -1)
-        close(stderrfd);
 }
 
 int virtTestCaptureProgramOutput(const char *const argv[],