mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 04:33:25 +00:00
A very minor tweak to the handling of leading '/' characters.
This commit is contained in:
parent
5b923e58db
commit
5450e56ba4
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=145207
@ -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 = ".";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user