[Libguestfs] [PATCH 2/2] tests: Don't leave a libguestfs tmpdir lying around after running test-launch-race.pl.

Richard W.M. Jones rjones at redhat.com
Tue Oct 6 10:48:55 UTC 2015


Calling _exit(2) in the child process has the side effect that
tmp/libguestfsXXXXXX is not cleaned up.  Clean it up by ensuring the
handle is properly closed before _exit.
---
 tests/protocol/test-launch-race.pl | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/protocol/test-launch-race.pl b/tests/protocol/test-launch-race.pl
index 6fef1a5..f522cc1 100755
--- a/tests/protocol/test-launch-race.pl
+++ b/tests/protocol/test-launch-race.pl
@@ -42,7 +42,9 @@ if ($pid == 0) {
   my $g = Sys::Guestfs->new ();
   $g->add_drive ("/dev/null");
   $g->launch ();
-  _exit (0); # So the tmpdir is not removed.
+  $g->close ();
+  # So $tmpdir is not removed by CLEANUP => 1 above.
+  _exit (0);
 }
 
 my $g = Sys::Guestfs->new ();
-- 
2.5.0




More information about the Libguestfs mailing list