diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-09-17 13:15:49 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-09-17 13:37:06 +0100 |
commit | e128a627fb8f39f4f4c11b782cef895bd79f0282 (patch) | |
tree | 4c75d040a7441f5019d41d3f05790ed009e1ae80 /src/filearch.c | |
parent | c387b69cba8f145438188b2b4567abbc9580ade0 (diff) | |
download | libguestfs-e128a627fb8f39f4f4c11b782cef895bd79f0282.tar.gz libguestfs-e128a627fb8f39f4f4c11b782cef895bd79f0282.tar.xz libguestfs-e128a627fb8f39f4f4c11b782cef895bd79f0282.zip |
Fix multiple errors where jump skips variable initialization.
<file>: error: jump skips variable initialization [-Werror=jump-misses-init]
This has only just appeared, possibly related to previous gnulib
update. In any case, this is just code motion / cleanup.
Diffstat (limited to 'src/filearch.c')
-rw-r--r-- | src/filearch.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/filearch.c b/src/filearch.c index 1802ec47..0b5d37bb 100644 --- a/src/filearch.c +++ b/src/filearch.c @@ -135,10 +135,13 @@ cpio_arch (guestfs_h *g, const char *file, const char *path) char cmd[cmd_len]; #define bin_len (dir_len + 32) char bin[bin_len]; - char *ret = NULL; - const char *method; + int64_t size; + int r; + const char *bins[] = INITRD_BINARIES2; + size_t i; + if (strstr (file, "gzip")) method = "zcat"; else if (strstr (file, "bzip2")) @@ -147,7 +150,7 @@ cpio_arch (guestfs_h *g, const char *file, const char *path) method = "cat"; /* Security: Refuse to download initrd if it is huge. */ - int64_t size = guestfs_filesize (g, path); + size = guestfs_filesize (g, path); if (size == -1 || size > 100000000) { error (g, _("size of %s unreasonable (%" PRIi64 " bytes)"), path, size); @@ -166,14 +169,12 @@ cpio_arch (guestfs_h *g, const char *file, const char *path) snprintf (cmd, cmd_len, "cd %s && %s initrd | cpio --quiet -id " INITRD_BINARIES1, dir, method); - int r = system (cmd); + r = system (cmd); if (r == -1 || WEXITSTATUS (r) != 0) { perrorf (g, "cpio command failed"); goto out; } - const char *bins[] = INITRD_BINARIES2; - size_t i; for (i = 0; i < sizeof bins / sizeof bins[0]; ++i) { snprintf (bin, bin_len, "%s/%s", dir, bins[i]); |