find: handle leading -- argument
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 6 Jan 2019 18:58:18 +0000 (19:58 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 6 Jan 2019 18:58:18 +0000 (19:58 +0100)
function                                             old     new   delta
find_main                                            464     478     +14

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
findutils/find.c

index 6407c6c5afd2c623ba532975932e17db23de6c14..06ad1b39c4848aee329772f32d877df163412730 100644 (file)
@@ -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;
        }