summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2021-07-01 09:38:35 +0300
committerSergey Poznyakoff <gray@gnu.org>2021-07-01 09:38:35 +0300
commite5bc23efcc90700710f97379d3116febc5705e19 (patch)
treeb2d148050b01151236e3cab864647bcc94a59ebc
parent12d67f44ded933ecb3f716553c091941596d702a (diff)
downloadtar-e5bc23efcc90700710f97379d3116febc5705e19.tar.gz
Fix the use of options with trailing slash in files-from list
* 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.
-rw-r--r--src/names.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/names.c b/src/names.c
index 503facb4..7773163c 100644
--- a/src/names.c
+++ b/src/names.c
@@ -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;