From 6e5e4420f42cb9d90641cc01f228b07d9b3c4ef3 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Sun, 4 Aug 2013 18:45:15 +0300 Subject: [PATCH] Bugfix. * src/names.c (read_name_from_file): Fix a typo. Remove unused variable. --- src/names.c | 5 ++--- tests/T-zfile.at | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/names.c b/src/names.c index 3704a91..4710848 100644 --- a/src/names.c +++ b/src/names.c @@ -363,11 +363,10 @@ read_name_from_file (struct name_elt *ent) size_t counter = 0; FILE *fp = ent->v.file.fp; int term = ent->v.file.term; - size_t count; for (c = getc (fp); c != EOF && c != term; c = getc (fp)) { - if (count == name_buffer_length) + if (counter == name_buffer_length) name_buffer = x2realloc (name_buffer, &name_buffer_length); name_buffer[counter++] = c; if (c == 0) @@ -381,7 +380,7 @@ read_name_from_file (struct name_elt *ent) if (counter == 0 && c != EOF) return file_list_skip; - if (count == name_buffer_length) + if (counter == name_buffer_length) name_buffer = x2realloc (name_buffer, &name_buffer_length); name_buffer[counter] = 0; diff --git a/tests/T-zfile.at b/tests/T-zfile.at index f4adfe8..8761c7c 100644 --- a/tests/T-zfile.at +++ b/tests/T-zfile.at @@ -18,6 +18,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +# Tar malfunctioned when given empty file as an argument to -T. +# +# Reported by: Michal Žejdl +# References: + AT_SETUP([empty file]) AT_KEYWORDS([files-from empty-file]) -- 2.45.2