diff options
author | kientzle <kientzle@FreeBSD.org> | 2005-04-17 19:46:50 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2005-04-17 19:46:50 +0000 |
commit | 6857f1e3f7a15b24267d8e0560cd689f291e84c7 (patch) | |
tree | 3fbf7b10ab2a06306b45beffb0f44dbd07201234 | |
parent | f666e865e6fb2def3ea20a0a4d61e8e65861d008 (diff) | |
download | FreeBSD-src-6857f1e3f7a15b24267d8e0560cd689f291e84c7.zip FreeBSD-src-6857f1e3f7a15b24267d8e0560cd689f291e84c7.tar.gz |
A very minor tweak to the handling of leading '/' characters.
-rw-r--r-- | usr.bin/tar/util.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tar/util.c b/usr.bin/tar/util.c index 7f1a944..69cc671 100644 --- a/usr.bin/tar/util.c +++ b/usr.bin/tar/util.c @@ -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 = "."; } |