From 382057f588fbf2c2f7950b85dd317721b8d04c07 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Mon, 21 Nov 2016 16:47:23 -0600 Subject: Have dirtree_notdotdot() pass through !node->parent so . and .. on the command line aren't filtered out. Audited all the callers and removed redundant calls, adjusted call sequence, etc. (And let rm _not_ do this, because posix.) --- toys/pending/diff.c | 2 +- toys/pending/tar.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/pending') diff --git a/toys/pending/diff.c b/toys/pending/diff.c index 53bdbce3..b2177c4f 100644 --- a/toys/pending/diff.c +++ b/toys/pending/diff.c @@ -484,7 +484,7 @@ static int list_dir (struct dirtree *node) { int ret = 0; - if (node->parent && !dirtree_notdotdot(node)) return 0; + if (!dirtree_notdotdot(node)) return 0; if (S_ISDIR(node->st.st_mode) && !node->parent) { //add root dirs. add_to_list(node); diff --git a/toys/pending/tar.c b/toys/pending/tar.c index 8d4c3d60..d672d102 100644 --- a/toys/pending/tar.c +++ b/toys/pending/tar.c @@ -274,7 +274,7 @@ static int add_to_tar(struct dirtree *node) return ((DIRTREE_RECURSE | ((toys.optflags & FLAG_h)?DIRTREE_SYMFOLLOW:0))); } - if (node->parent && !dirtree_notdotdot(node)) return 0; + if (!dirtree_notdotdot(node)) return 0; path = dirtree_path(node, 0); add_file(hdl, &path, &(node->st)); //path may be modified free(path); -- cgit v1.2.3