mirror of
https://github.com/AuxXxilium/eudev.git
synced 2024-12-28 06:35:34 +07:00
56116314d1
The klibc implementation of getopt_long() behaves slightly different from the glibc one - in particular, it treats the change of the option string argument between invocations as start of parsing a different command line, and resets its state. However, the udevadm code expected getopt_long() invocations in subcommands to continue parsing the rest of command line after initial options has been parsed at the top level; with klibc this broke, causing all udevadm subcommands to stop recognizing their options. Instead of relying on the glibc behavior, reset the getopt_long() state properly before invoking the subcommand handler: move argv to point to the subcommand name, decrease argc appropriately, and set optind = 0. This also fixes a minor bug visible with glibc - without setting optind = 0 all getopt_long() calls in subcommand handlers were behaving as if "+" was specified as the first character of the option string (which disables option reordering), because that state was set by the first getopt_long() call at the top level, and was not reset when parsing subcommand options. Signed-off-by: Sergey Vlasov <vsu@altlinux.ru> |
||
---|---|---|
.. | ||
lib | ||
.gitignore | ||
Makefile.am | ||
test-udev.c | ||
udev-event.c | ||
udev-node.c | ||
udev-rules.c | ||
udev-selinux.c | ||
udev-sysdeps.h | ||
udev-util.c | ||
udev.h | ||
udev.xml | ||
udevadm-control.c | ||
udevadm-info.c | ||
udevadm-monitor.c | ||
udevadm-settle.c | ||
udevadm-test.c | ||
udevadm-trigger.c | ||
udevadm.c | ||
udevadm.xml | ||
udevd.c | ||
udevd.xml |