chiark / gitweb /
udev: set optind = 0, not the usual 1, to reset getopt_long()s internal state
[elogind.git] / src / udev / udevadm.c
index d1e9756b2e5f3417e95c5cbead0c58f8348b9770..5e69e192c03bd75d1e8e2ebe3b63d98e5846ece8 100644 (file)
@@ -134,7 +134,8 @@ int main(int argc, char *argv[])
                         if (strcmp(udevadm_cmds[i]->name, command) == 0) {
                                 argc -= optind;
                                 argv += optind;
-                                optind = 1;
+                                /* we need '0' here to reset the internal state */
+                                optind = 0;
                                 rc = run_command(udev, udevadm_cmds[i], argc, argv);
                                 goto out;
                         }