#include <sys/stat.h>
#include <sys/wait.h>
#include <locale.h>
+#include <limits.h>
#include <guestfs.h>
#define STRCASENEQLEN(a,b,n) (strncasecmp((a),(b),(n)) != 0)
#define STRPREFIX(a,b) (strncmp((a),(b),strlen((b))) == 0)
+#ifndef P_tmpdir
+#define P_tmpdir "/tmp"
+#endif
+
#define DEFAULT_TIMEOUT 120
static const char *helper = DEFAULT_HELPER;
static int timeout = DEFAULT_TIMEOUT;
-static char tmpf[] = "/tmp/libguestfs-test-tool-sda-XXXXXX";
-static char isof[] = "/tmp/libguestfs-test-tool-iso-XXXXXX";
+static char tmpf[] = P_tmpdir "/libguestfs-test-tool-sda-XXXXXX";
+static char isof[] = P_tmpdir "/libguestfs-test-tool-iso-XXXXXX";
static guestfs_h *g;
static void preruncheck (void);
_("libguestfs-test-tool: failed to create libguestfs handle\n"));
exit (EXIT_FAILURE);
}
- if (guestfs_add_drive (g, tmpf) == -1) {
+ if (guestfs_add_drive_opts (g, tmpf,
+ GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+ -1) == -1) {
fprintf (stderr,
_("libguestfs-test-tool: failed to add drive '%s'\n"),
tmpf);
exit (EXIT_FAILURE);
}
- if (guestfs_add_drive (g, isof) == -1) {
+ if (guestfs_add_drive_opts (g, isof,
+ GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
+ GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
+ -1) == -1) {
fprintf (stderr,
_("libguestfs-test-tool: failed to add drive '%s'\n"),
isof);
exit (EXIT_SUCCESS);
}
-static char qemuwrapper[] = "/tmp/libguestfs-test-tool-wrapper-XXXXXX";
+static char qemuwrapper[] = P_tmpdir "/libguestfs-test-tool-wrapper-XXXXXX";
static void
cleanup_wrapper (void)