aboutsummaryrefslogtreecommitdiff
path: root/toys/posix
diff options
context:
space:
mode:
Diffstat (limited to 'toys/posix')
-rw-r--r--toys/posix/chmod.c2
-rw-r--r--toys/posix/grep.c2
-rw-r--r--toys/posix/rm.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/toys/posix/chmod.c b/toys/posix/chmod.c
index 572dff6a..42924399 100644
--- a/toys/posix/chmod.c
+++ b/toys/posix/chmod.c
@@ -43,7 +43,7 @@ static int do_chmod(struct dirtree *try)
{
mode_t mode;
- if (try->parent && !dirtree_notdotdot(try)) return 0;
+ if (!dirtree_notdotdot(try)) return 0;
mode = string_to_mode(TT.mode, try->st.st_mode);
if (toys.optflags & FLAG_v) {
diff --git a/toys/posix/grep.c b/toys/posix/grep.c
index 2fe6ac27..a95203a0 100644
--- a/toys/posix/grep.c
+++ b/toys/posix/grep.c
@@ -313,7 +313,7 @@ static int do_grep_r(struct dirtree *new)
{
char *name;
- if (new->parent && !dirtree_notdotdot(new)) return 0;
+ if (!dirtree_notdotdot(new)) return 0;
if (S_ISDIR(new->st.st_mode)) return DIRTREE_RECURSE;
// "grep -r onefile" doesn't show filenames, but "grep -r onedir" should.
diff --git a/toys/posix/rm.c b/toys/posix/rm.c
index 99fa8edf..2f99c326 100644
--- a/toys/posix/rm.c
+++ b/toys/posix/rm.c
@@ -28,7 +28,7 @@ static int do_rm(struct dirtree *try)
int dir = S_ISDIR(try->st.st_mode), or = 0, using = 0;
// Skip . and .. (yes, even explicitly on the command line: posix says to)
- if (!dirtree_notdotdot(try)) return 0;
+ if (isdotdot(try->name)) return 0;
// Intentionally fail non-recursive attempts to remove even an empty dir
// (via wrong flags to unlinkat) because POSIX says to.