From e2fe7499b66699cdb86a147e1f8aa11554171b92 Mon Sep 17 00:00:00 2001 From: Tim Kientzle Date: Sun, 27 Jun 2004 18:32:14 +0000 Subject: [PATCH] Warn about stripping leading '/' when creating archives. --- usr.bin/tar/write.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c index dc2ddc0326b8..c8cac23d25fe 100644 --- a/usr.bin/tar/write.c +++ b/usr.bin/tar/write.c @@ -794,8 +794,15 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, struct stat *st, } /* Strip leading '/' unless user has asked us not to. */ - if (pathname && pathname[0] == '/' && !bsdtar->option_absolute_paths) + if (pathname && pathname[0] == '/' && !bsdtar->option_absolute_paths) { + /* Generate a warning the first time this happens. */ + if (!bsdtar->warned_lead_slash) { + bsdtar_warnc(bsdtar, 0, + "Removing leading '/' from member names"); + bsdtar->warned_lead_slash = 1; + } pathname++; + } archive_entry_set_pathname(entry, pathname);