#include <stdio.h>
#include <stdlib.h>
+#include <inttypes.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
guestfs_set_verbose (g, verbose);
break;
- case 'V':
- printf ("%s %s\n", program_name, PACKAGE_VERSION);
+ case 'V': {
+ struct guestfs_version *v = guestfs_version (g);
+ printf ("%s %"PRIi64".%"PRIi64".%"PRIi64"%s\n", program_name,
+ v->major, v->minor, v->release, v->extra);
exit (EXIT_SUCCESS);
+ }
case 'x':
guestfs_set_trace (g, 1);
/* If we've got mountpoints, we must launch the guest and mount them. */
if (mps != NULL) {
+ /* RHBZ#612178: If --listen flag is given, then we will fork into
+ * the background in rc_listen(). However you can't do this while
+ * holding a libguestfs handle open because the recovery process
+ * will think the main program has died and kill qemu. Therefore
+ * don't use the recovery process for this case. (A better
+ * solution would be to call launch () etc after the fork, but
+ * that greatly complicates the code here).
+ */
+ if (remote_control_listen)
+ guestfs_set_recovery_proc (g, 0);
+
if (launch (g) == -1) exit (EXIT_FAILURE);
mount_mps (mps);
}