libudev/path-util.c: remove usage of canonicalize_file_name()

this is a glibc specific alias for realpath(path, NULL).
to be portable, we need to use the real thing which is even less
verbose.

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev/sparse-endian.h: include header which defines __bswap_XX

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
udev/udevadm-hwdb.c: remove usage of qsort_r

while theoretically a nice interface, qsort_r on GLIBC was
implemented with a prototype that shuffles the argument order
around when compared to the traditional BSD implementations,
yielding in 2 separate incompatible implementations.
even worse, the arguments are all of pointer type so one would
not even notice that the order is wrong and so this would yield
in crashes or silent memory corruption.
thus musl does not implement it, because configure scripts would
check for its existance and use it unconditionally, even when
assuming the BSD version.

a more portable solution is to use TLS via __thread, which any
modern GCC should provide. (even 3.4.6 on x86/x86_64 does so).

Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
libudev-util.c: Fix sysconf variable for util_lookup_group

Signed-off-by: Michael Forney <mforney@mforney.org>
libudev-util.c: Handle -1 return from sysconf(_SC_GET{PW,GR}_R_SIZE_MAX)

POSIX says:

    Note that sysconf(_SC_GETGR_R_SIZE_MAX) may return -1 if there is no
    hard limit on the size of the buffer needed to store all the groups
    returned.

The example from POSIX uses a default buffer size of 1024 in that case.

Signed-off-by: Michael Forney <mforney@mforney.org>