From e2c01a16b75212f48e8e65bc53b7fb47329b544d Mon Sep 17 00:00:00 2001 From: George Hartzell Date: Thu, 29 Sep 2016 14:30:44 -0700 Subject: [PATCH] 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. --- examples/minitar/minitar.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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); -- 2.47.2