summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-07-22 16:51:05 +0100
committerRichard Jones <rjones@redhat.com>2010-07-22 16:51:56 +0100
commit2fd8c259d3daa88b0cdf98090bb57f3dbd178432 (patch)
treeadd2a18daaa1dfbf3977e63da5f7222ce8a71728 /src
parent799d52be4f08f6c70c0e8ba1aa7367ba4cdd78c4 (diff)
downloadlibguestfs-2fd8c259d3daa88b0cdf98090bb57f3dbd178432.tar.gz
libguestfs-2fd8c259d3daa88b0cdf98090bb57f3dbd178432.tar.xz
libguestfs-2fd8c259d3daa88b0cdf98090bb57f3dbd178432.zip
Move variable initialization close to variable use.
Diffstat (limited to 'src')
-rw-r--r--src/guestfs.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/guestfs.c b/src/guestfs.c
index d6c8d603..764f7298 100644
--- a/src/guestfs.c
+++ b/src/guestfs.c
@@ -836,9 +836,6 @@ int
guestfs__add_drive_ro_with_if (guestfs_h *g, const char *filename,
const char *drive_if)
{
- size_t len = strlen (filename) + 64;
- char buf[len];
-
if (strchr (filename, ',') != NULL) {
error (g, _("filename cannot contain ',' (comma) character"));
return -1;
@@ -849,6 +846,9 @@ guestfs__add_drive_ro_with_if (guestfs_h *g, const char *filename,
return -1;
}
+ size_t len = strlen (filename) + 64;
+ char buf[len];
+
snprintf (buf, len, "file=%s,snapshot=on,if=%s", filename, drive_if);
return guestfs__config (g, "-drive", buf);