A very minor tweak to the handling of leading '/' characters.

This commit is contained in:
Tim Kientzle 2005-04-17 19:46:50 +00:00
parent 5b923e58db
commit 5450e56ba4
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145207

View File

@ -412,6 +412,10 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
if (name[0] == '.' && name[1] == '/' && name[2] != '\0')
name += 2;
/* Strip redundant leading '/' characters. */
while (name[0] == '/' && name[1] == '/')
name++;
/* Strip leading '/' unless user has asked us not to. */
if (name[0] == '/' && !bsdtar->option_absolute_paths) {
/* Generate a warning the first time this happens. */
@ -421,7 +425,8 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry)
bsdtar->warned_lead_slash = 1;
}
name++;
if (*name == '\0') /* Strip '/' from "/" yields "." */
/* Special case: Stripping leading '/' from "/" yields ".". */
if (*name == '\0')
name = ".";
}