Browse Source

Bugfix.

* src/names.c (read_name_from_file): Fix a typo. Remove
unused variable.
Sergey Poznyakoff 11 years ago
parent
commit
6e5e4420f4
2 changed files with 7 additions and 3 deletions
  1. 2 3
      src/names.c
  2. 5 0
      tests/T-zfile.at

+ 2 - 3
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;
 

+ 5 - 0
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 <http://www.gnu.org/licenses/>.
 
+# Tar malfunctioned when given empty file as an argument to -T.
+#
+# Reported by: Michal Žejdl <[email protected]>
+# References: <http://lists.gnu.org/archive/html/bug-tar/2013-07/msg00009.html>
+
 AT_SETUP([empty file])
 AT_KEYWORDS([files-from empty-file])