From f0f368b56b58016cf9c2d6dfdd215ef0041ee7cd Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 3 May 2023 22:37:48 -0500 Subject: [PATCH] Fix error reporting for find -commands that take an argument but haven't got one because they're at the end of the command line. This unknown commands, because the logic is an if/else staircase handling commands that reaches an "else { everything after here takes an argument" that pops the argument, then has an eventual else goto error; for unknown commands. Since argv[] always ends with a NULL pointer, we were trying to print that in the error message. --- toys/posix/find.c | 1 + 1 file changed, 1 insertion(+) diff --git a/toys/posix/find.c b/toys/posix/find.c index f82817ca..8beb521e 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -687,6 +687,7 @@ cont: return recurse; error: + if (!*ss) --ss; error_exit("bad arg '%s'", *ss); } -- 2.39.2