eudev/udev
Sergey Vlasov 56116314d1 udevadm: fix option parsing breakage with klibc
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>
2008-11-15 02:01:15 +01:00
..
lib libudev: device - handle disk "device" link for partitions in deprecated sysfs layout 2008-11-14 18:26:49 +01:00
.gitignore gitignore: move *.8 to subdirs 2008-09-29 05:03:43 +02:00
Makefile.am do not use the new work-in-progress parser rule matcher 2008-10-21 12:45:54 +02:00
test-udev.c cache uid/gid during rule parsing 2008-10-24 10:51:04 +02:00
udev-event.c $links should be relative 2008-11-05 22:13:49 +01:00
udev-node.c fix cleanup of possible left-over symlinks 2008-11-05 04:45:23 +01:00
udev-rules.c remove len == 0 check, the index root is always '\0' 2008-11-13 18:21:28 +01:00
udev-selinux.c selinux_init(udev) -> udev_selinux_init(udev) 2008-10-18 19:30:42 +02:00
udev-sysdeps.h set errno = ENOSYS in inotify stub 2008-11-13 01:52:33 +01:00
udev-util.c fix indentation 2008-11-06 02:56:45 +01:00
udev.h unify string replacement 2008-11-05 21:49:52 +01:00
udev.xml ATTR{}== always fails if the attribute does not exist 2008-10-29 22:22:12 +01:00
udevadm-control.c use no_argument, required_argument, optional_argument in longopts 2008-10-02 16:49:05 +02:00
udevadm-info.c udevadm: info - unify -V and --version 2008-11-13 07:31:04 +01:00
udevadm-monitor.c use no_argument, required_argument, optional_argument in longopts 2008-10-02 16:49:05 +02:00
udevadm-settle.c fix uninitialized variable warnings 2008-10-24 09:37:37 +02:00
udevadm-test.c cache uid/gid during rule parsing 2008-10-24 10:51:04 +02:00
udevadm-trigger.c libudev: device - get_attr_value() -> get_sysattr_value() 2008-10-20 18:12:36 +02:00
udevadm.c udevadm: fix option parsing breakage with klibc 2008-11-15 02:01:15 +01:00
udevadm.xml udevadm: trigger: use libudev 2008-09-30 13:43:35 +02:00
udevd.c set errno = ENOSYS in inotify stub 2008-11-13 01:52:33 +01:00
udevd.xml udevadm: add --version --help options to man page, hide them as commands 2008-09-07 14:48:33 +02:00