udev: split out help and modernise a bit

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: split out parse_argv()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: drop duplicate logging

Once upon a time logging during early boot was unreliable, so extra logging messages were
sent by udev to stderr. That is no longer a concern, so drop all fprintf() calls from udved.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: don't close std{in,out,err}

Rather than printing debug output to stderr and redirecting this to /dev/null when not wanted,
use the correct log_*() function in the first place.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udevd: initialize epoll_event structs on allocation

Also move the rest of event initialization next to the event loop (no functional change).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: only print after final log level has been determined

This delays label_init(), and drops the (duplicate) printing of version
information.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: apply permissions to static nodes before signallying READY

Processes expecting static nodes to have the right permissions may order themselves after systemd-udevd.service,
make sure that actually guarantees what is expected.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev: drop util_lookup_{user,group}

Use shared versions instead. Difference is with overwriting of repeated user/group
name, and lack of logging.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev: util - drop util_delete_path()

Use rmdir_parents() from src/shared instead.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udevd: use safe_ato*() in place of strto*()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: rules - add missing whitespace to log message

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: rules - close empty file

If the file is found to be empty, we exit early without closing the file first.

Found by coverity. Fixes CID #1237759.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: event - modernize spawn_read()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: event - explicitly don't read() from invalid fd

This fixes CID #1237641.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: event - modernize spawn_exec()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev: util - use log_level_from_string()

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
src/shared: import upstream code needed for recent commits

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>