From: George Hartzell Date: Thu, 29 Sep 2016 21:30:44 +0000 (-0700) Subject: Fix scoping error with "disk" variable X-Git-Tag: v3.2.2~9^2~9^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2c01a16b75212f48e8e65bc53b7fb47329b544d;p=thirdparty%2Flibarchive.git Fix scoping error with "disk" variable The variable named 'disk' inside the loop was hiding the variable named 'disk' at the outer level. The outer variable was never used, get rid of it. Move the call to archive_read_disk_set_standard_lookup(disk) inside the loop so that it Does What It Should. --- diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c index 81e5e11c7..0b4b4147c 100644 --- a/examples/minitar/minitar.c +++ b/examples/minitar/minitar.c @@ -222,7 +222,6 @@ static void create(const char *filename, int compress, const char **argv) { struct archive *a; - struct archive *disk; struct archive_entry *entry; ssize_t len; int fd; @@ -253,12 +252,11 @@ create(const char *filename, int compress, const char **argv) filename = NULL; archive_write_open_filename(a, filename); - disk = archive_read_disk_new(); -#ifndef NO_LOOKUP - archive_read_disk_set_standard_lookup(disk); -#endif while (*argv != NULL) { struct archive *disk = archive_read_disk_new(); +#ifndef NO_LOOKUP + archive_read_disk_set_standard_lookup(disk); +#endif int r; r = archive_read_disk_open(disk, *argv);