]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
Fix the use of options with trailing slash in files-from list
authorSergey Poznyakoff <gray@gnu.org>
Thu, 1 Jul 2021 06:38:35 +0000 (09:38 +0300)
committerSergey Poznyakoff <gray@gnu.org>
Thu, 1 Jul 2021 06:38:35 +0000 (09:38 +0300)
* src/names.c (read_name_from_file): Do not remove trailing slash
here, since name_buffer might contain an option (e.g. -C /).
(read_next_name): Remove trailing slash when we're sure we're dealing
with a file name.
See 163e96a0.

src/names.c

index 503facb4a6cbd0b8bf73be5d9b7fd59d8ba9e7ac..7773163c92db85131dbd973369a381d2974a0c73 100644 (file)
@@ -980,7 +980,6 @@ read_name_from_file (struct name_elt *ent)
   if (counter == name_buffer_length)
     name_buffer = x2realloc (name_buffer, &name_buffer_length);
   name_buffer[counter] = 0;
-  chopslash (name_buffer);
   return (counter == 0 && c == EOF) ? file_list_end : file_list_success;
 }
 
@@ -1060,6 +1059,7 @@ read_next_name (struct name_elt *ent, struct name_elt *ret)
                  return 1;
                }
            }
+         chopslash (name_buffer);
          ret->type = NELT_NAME;
          ret->v.name = name_buffer;
          return 0;