diff options
author | Kay Sievers <kay@vrfy.org> | 2012-10-25 21:31:38 +0200 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2012-10-25 21:31:38 +0200 |
commit | e5f2783e73a98cfb067f10eeed2289b454c9e672 (patch) | |
tree | 609fd295cb11df0440aa0055f2637c212f859cf6 /src | |
parent | job: avoid recursion into transaction code from job cancelation (diff) | |
download | systemd-e5f2783e73a98cfb067f10eeed2289b454c9e672.tar.xz systemd-e5f2783e73a98cfb067f10eeed2289b454c9e672.zip |
udev: set optind = 0, not the usual 1, to reset getopt_long()s internal state
Diffstat (limited to 'src')
-rw-r--r-- | src/udev/udev-builtin.c | 3 | ||||
-rw-r--r-- | src/udev/udevadm.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index 18fc3df274..26ee16c669 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -127,7 +127,8 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c int argc; char *argv[128]; - optind = 1; + /* we need '0' here to reset the internal state */ + optind = 0; util_strscpy(arg, sizeof(arg), command); udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); return builtins[cmd]->cmd(dev, argc, argv, test); diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index d1e9756b2e..5e69e192c0 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -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; } |