From: Eric Blake Date: Fri, 10 Dec 2010 22:30:56 +0000 (-0700) Subject: test: fix commandtest under autobuild.sh X-Git-Tag: v0.8.7~103 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7aaf4e6439c473c659ee2841cf9d89632aca7bb1;p=thirdparty%2Flibvirt.git test: fix commandtest under autobuild.sh * tests/commandtest.c (mymain): Kill off any leaked-in fds. * autobuild.sh: Don't leak fds. Signed-off-by: Eric Blake --- diff --git a/autobuild.sh b/autobuild.sh index 8248a5954e..91e2ab2b80 100755 --- a/autobuild.sh +++ b/autobuild.sh @@ -38,7 +38,7 @@ make install exec 3>&1 st=$( exec 4>&1 >&3 - { make check syntax-check 2>&1; echo $? >&4; } | tee "$RESULTS" + { make check syntax-check 2>&1 3>&- 4>&-; echo $? >&4; } | tee "$RESULTS" ) exec 3>&- test "$st" = 0 diff --git a/tests/commandtest.c b/tests/commandtest.c index a1bcf688e3..333dd4d57c 100644 --- a/tests/commandtest.c +++ b/tests/commandtest.c @@ -688,6 +688,12 @@ mymain(int argc, char **argv) if (chdir("/tmp") < 0) return(EXIT_FAILURE); + /* Kill off any inherited fds that might interfere with our + * testing. */ + close(3); + close(4); + close(5); + virInitialize(); const char *const newenv[] = {