diff options
-rwxr-xr-x | tests/find.test | 1 | ||||
-rw-r--r-- | toys/posix/find.c | 2 |
2 files changed, 2 insertions, 1 deletions
diff --git a/tests/find.test b/tests/find.test index 71a55010..f4277375 100755 --- a/tests/find.test +++ b/tests/find.test @@ -142,5 +142,6 @@ testing "-L broken" "find -L broken" "broken\n" "" "" testing "one slash" 'find /etc/ -maxdepth 1 | grep /passwd\$' '/etc/passwd\n' \ '' '' +testing 'empty arg' 'find "" dir -name file 2>/dev/null' 'dir/file\n' '' '' rm -rf dir diff --git a/toys/posix/find.c b/toys/posix/find.c index ff127b91..2d8ca0b1 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -690,7 +690,7 @@ void find_main(void) // Distinguish paths from filters for (len = 0; toys.optargs[len]; len++) - if (strchr("-!(", *toys.optargs[len])) break; + if (*toys.optargs[len] && strchr("-!(", *toys.optargs[len])) break; TT.filter = toys.optargs+len; // use "." if no paths |