maint: guestfs.c: remove unnecessary initialization
[libguestfs.git] / src / guestfs.c
index 04bd4e8..20afb63 100644 (file)
@@ -19,7 +19,6 @@
 #include <config.h>
 
 #define _BSD_SOURCE /* for mkdtemp, usleep */
-#define _GNU_SOURCE /* for vasprintf, GNU strerror_r, strchrnul */
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -348,6 +347,10 @@ guestfs_close (guestfs_h *g)
   g->fd[1] = -1;
   g->sock = -1;
 
+  /* Wait for subprocess(es) to exit. */
+  waitpid (g->pid, NULL, 0);
+  if (g->recoverypid > 0) waitpid (g->recoverypid, NULL, 0);
+
   /* Remove tmpfiles. */
   if (g->tmpdir) {
     snprintf (filename, sizeof filename, "%s/sock", g->tmpdir);
@@ -2410,7 +2413,7 @@ guestfs__receive_file_sync (guestfs_h *g, const char *filename)
     return -1;
   }
 
-  while ((r = receive_file_data_sync (g, NULL, NULL)) > 0)
+  while (receive_file_data_sync (g, NULL, NULL) > 0)
     ;                          /* just discard it */
 
   return -1;