From 0f3d8ee513d63282e72df37b97e35ff1a4e4d646 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 13 Nov 2015 13:29:58 -0800 Subject: Fix find -perm. 1) It read st_dev instead of st_mode. 2) It reversed the semantics of absolute vs minimal ('-' prefixed) tests. Add tests for these, and move the "unterminated -exec" test into the "Still fails" section because it's still dumping core for me. --- toys/posix/find.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'toys/posix') diff --git a/toys/posix/find.c b/toys/posix/find.c index aca19845..f6701845 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -279,9 +279,9 @@ static int do_find(struct dirtree *new) if (check) { char *m = ss[1]; mode_t m1 = string_to_mode(m+(*m == '-'), 0), - m2 = new->st.st_dev & 07777; + m2 = new->st.st_mode & 07777; - if (*m != '-') m2 &= m1; + if (*m == '-') m2 &= m1; test = m1 == m2; } } else if (!strcmp(s, "type")) { -- cgit v1.2.3