Displaying 3 results from an estimated 3 matches for "valid_format".
2017 Jun 08
1
[PATCH] lib: create: Allow any [[:alnum:]]+ string as a backingfmt parameter.
...00644
--- a/lib/create.c
+++ b/lib/create.c
@@ -241,6 +241,14 @@ is_power_of_2 (unsigned v)
return v && ((v & (v - 1)) == 0);
}
+/**
+ * Check for valid backing format. Allow any C<^[[:alnum]]+$>
+ * (in C locale), but limit the length to something reasonable.
+ */
+#define VALID_FORMAT(format) \
+ guestfs_int_string_is_valid ((format), 1, 16, \
+ VALID_FLAG_ALPHA|VALID_FLAG_DIGIT, "")
+
static int
disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size,
const char *backingfile,
@@ -267,12 +275,7 @@ di...
2018 Aug 22
1
[PATCH] lib: create: avoid one extra string allocation
...if (orig_filename[0] != '/')
- filename = safe_asprintf (g, "./%s", orig_filename);
- else
- filename = safe_strdup (g, orig_filename);
-
if (optargs->bitmask & GUESTFS_DISK_CREATE_BACKINGFORMAT_BITMASK) {
backingformat = optargs->backingformat;
if (!VALID_FORMAT (backingformat)) {
@@ -341,13 +330,21 @@ disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size,
}
/* Complete the command line. */
- guestfs_int_cmd_add_arg (cmd, filename);
+ /* If the filename is something like "file:foo" then qemu-img will
+ * try to inte...
2017 Jun 25
0
Re: [PATCH 1/2] launch: add support for autodetection of appliance image format
...ameter ā%sā"),
> backingformat);
> return -1;
I think this is patch is against an older version of libguestfs?
The current code has:
if (optargs->bitmask & GUESTFS_DISK_CREATE_BACKINGFORMAT_BITMASK) {
backingformat = optargs->backingformat;
if (!VALID_FORMAT (backingformat)) {
error (g, _("invalid value for backingformat parameter ā%sā"),
backingformat);
return -1;
}
}
so this hunk can just be omitted.
> @@ -321,7 +322,7 @@ disk_create_qcow2 (guestfs_h *g, const char *orig_filename, int64_t size,
>...