I enabled the -Wshadow warning temporarily in order to do these fixes, but had to disable it again afterwards. The reason is that this warns about shadowing globals, which is sort of a good thing, but because we have a global called "verbose" just about everywhere, and at the same time we baked a function argument called "verbose" into several unchangable APIs, well, we're stuck without being able to use this warning. --- daemon/augeas.c | 12 ++++++------ daemon/btrfs.c | 2 +- daemon/mkfs.c | 8 ++++---- src/events.c | 2 +- src/inspect-fs-windows.c | 1 - src/launch-direct.c | 1 - src/launch-uml.c | 1 - src/proto.c | 6 +++--- 8 files changed, 15 insertions(+), 18 deletions(-) diff --git a/daemon/augeas.c b/daemon/augeas.c index 59d3508..ea1163f 100644 --- a/daemon/augeas.c +++ b/daemon/augeas.c @@ -35,13 +35,13 @@ if (code == AUG_ENOMEM) \ reply_with_error (fs ": augeas out of memory", ##__VA_ARGS__); \ else { \ - const char *message = aug_error_message (aug); \ - const char *minor = aug_error_minor_message (aug); \ - const char *details = aug_error_details (aug); \ + const char *aug_err_message = aug_error_message (aug); \ + const char *aug_err_minor = aug_error_minor_message (aug); \ + const char *aug_err_details = aug_error_details (aug); \ fprintf (stderr, fs ": %s%s%s%s%s", ##__VA_ARGS__, \ - message, \ - minor ? ": " : "", minor ? minor : "", \ - details ? ": " : "", details ? details : ""); \ + aug_err_message, \ + aug_err_minor ? ": " : "", aug_err_minor ? aug_err_minor : "", \ + aug_err_details ? ": " : "", aug_err_details ? aug_err_details : ""); \ } \ } while (0) diff --git a/daemon/btrfs.c b/daemon/btrfs.c index 652a17e..85dbe00 100644 --- a/daemon/btrfs.c +++ b/daemon/btrfs.c @@ -511,7 +511,7 @@ do_btrfs_subvolume_list (const mountable_t *fs) goto error; } - for (size_t i = 0; i < nr_subvolumes; ++i) { + for (i = 0; i < nr_subvolumes; ++i) { /* To avoid allocations, reuse the 'line' buffer to store the * path. Thus we don't need to free 'line', since it will be * freed by the calling (XDR) code. diff --git a/daemon/mkfs.c b/daemon/mkfs.c index ee9e46d..dde35b2 100644 --- a/daemon/mkfs.c +++ b/daemon/mkfs.c @@ -117,14 +117,14 @@ do_mkfs (const char *fstype, const char *device, int blocksize, * have to determine the block device sector size in order to do * this. */ - int sectorsize = do_blockdev_getss (device); - if (sectorsize == -1) + int ss = do_blockdev_getss (device); + if (ss == -1) return -1; - int sectors_per_cluster = blocksize / sectorsize; + int sectors_per_cluster = blocksize / ss; if (sectors_per_cluster < 1 || sectors_per_cluster > 128) { reply_with_error ("unsupported cluster size for %s filesystem (requested cluster size = %d, sector size = %d, trying sectors per cluster = %d)", - fstype, blocksize, sectorsize, sectors_per_cluster); + fstype, blocksize, ss, sectors_per_cluster); return -1; } diff --git a/src/events.c b/src/events.c index 5fed0c0..2d065b8 100644 --- a/src/events.c +++ b/src/events.c @@ -132,7 +132,7 @@ guestfs_int_call_callbacks_message (guestfs_h *g, uint64_t event, event == GUESTFS_EVENT_WARNING || event == GUESTFS_EVENT_TRACE)) { bool from_appliance = event == GUESTFS_EVENT_APPLIANCE; - size_t i, i0; + size_t i0; /* APPLIANCE => <buf> * LIBRARY => libguestfs: <buf>\n diff --git a/src/inspect-fs-windows.c b/src/inspect-fs-windows.c index f8df5e5..af28bb7 100644 --- a/src/inspect-fs-windows.c +++ b/src/inspect-fs-windows.c @@ -451,7 +451,6 @@ check_windows_system_registry (guestfs_h *g, struct inspect_fs *fs) /* Get the binary value. Is it a fixed disk? */ CLEANUP_FREE char *blob = NULL; char *device; - size_t len; int64_t type; type = guestfs_hivex_value_type (g, v); diff --git a/src/launch-direct.c b/src/launch-direct.c index 7540c19..29ec359 100644 --- a/src/launch-direct.c +++ b/src/launch-direct.c @@ -718,7 +718,6 @@ launch_direct (guestfs_h *g, void *datav, const char *arg) if (g->recovery_proc) { r = fork (); if (r == 0) { - int i; struct sigaction sa; pid_t qemu_pid = data->pid; pid_t parent_pid = getppid (); diff --git a/src/launch-uml.c b/src/launch-uml.c index 2ec7022..5bd0ce7 100644 --- a/src/launch-uml.c +++ b/src/launch-uml.c @@ -350,7 +350,6 @@ launch_uml (guestfs_h *g, void *datav, const char *arg) if (g->recovery_proc) { r = fork (); if (r == 0) { - int i; struct sigaction sa; pid_t vmlinux_pid = data->pid; pid_t parent_pid = getppid (); diff --git a/src/proto.c b/src/proto.c index efe9dfb..cb884bf 100644 --- a/src/proto.c +++ b/src/proto.c @@ -174,14 +174,14 @@ check_daemon_socket (guestfs_h *g) /* Read and process progress messages that happen during FileIn. */ if (flag == GUESTFS_PROGRESS_FLAG) { - char buf[PROGRESS_MESSAGE_SIZE]; + char mbuf[PROGRESS_MESSAGE_SIZE]; guestfs_progress message; - n = g->conn->ops->read_data (g, g->conn, buf, PROGRESS_MESSAGE_SIZE); + n = g->conn->ops->read_data (g, g->conn, mbuf, PROGRESS_MESSAGE_SIZE); if (n <= 0) /* 0 or -1 */ return n; - xdrmem_create (&xdr, buf, PROGRESS_MESSAGE_SIZE, XDR_DECODE); + xdrmem_create (&xdr, mbuf, PROGRESS_MESSAGE_SIZE, XDR_DECODE); xdr_guestfs_progress (&xdr, &message); xdr_destroy (&xdr); -- 2.5.0