[git commit] find: handle leading -- argument

Denys Vlasenko vda.linux at googlemail.com
Sun Jan 6 18:58:18 UTC 2019


commit: https://git.busybox.net/busybox/commit/?id=2d9e09796342ab202e780a6cb613b532c7356aec
branch: https://git.busybox.net/busybox/commit/?id=refs/heads/master

function                                             old     new   delta
find_main                                            464     478     +14

Signed-off-by: Denys Vlasenko <vda.linux at googlemail.com>
---
 findutils/find.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/findutils/find.c b/findutils/find.c
index 6407c6c5a..06ad1b39c 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -1467,6 +1467,12 @@ int find_main(int argc UNUSED_PARAM, char **argv)
 			break;
 		if (!saved[1])
 			break; /* it is "-" */
+		if (saved[1] == '-' && !saved[2]) {
+			/* it is "--" */
+			/* Try: find -- /dev/null */
+			saved = *++past_HLP;
+			break;
+		}
 		if ((saved+1)[strspn(saved+1, "HLP")] != '\0')
 			break;
 	}


More information about the busybox-cvs mailing list