aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorColin Percival <cperciva@FreeBSD.org>2007-05-03 04:33:11 +0000
committerColin Percival <cperciva@FreeBSD.org>2007-05-03 04:33:11 +0000
commitc85ac10468a3e60df6f66ffa5ef29ebd5d756c0a (patch)
treeb71ae125fa4a291fa58155f5053f3603f7717f22 /usr.bin
parent9310f22692ecb1ca22f36910a8050340ee8f9fb7 (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tar/write.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/usr.bin/tar/write.c b/usr.bin/tar/write.c
index ffbee4e81428..76d6fcfd1c24 100644
--- a/usr.bin/tar/write.c
+++ b/usr.bin/tar/write.c
@@ -649,6 +649,16 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path)
if (lst == NULL) {
/* Couldn't lstat(); must not exist. */
bsdtar_warnc(bsdtar, errno, "%s: Cannot stat", name);
+
+ /*
+ * Report an error via the exit code if the failed
+ * path is a prefix of what the user provided via
+ * the command line. (Testing for string equality
+ * here won't work due to trailing '/' characters.)
+ */
+ if (memcmp(name, path, strlen(name)) == 0)
+ bsdtar->return_value = 1;
+
continue;
}
if (S_ISLNK(lst->st_mode))