Replace strdupa call by standard strdup

strdupa appears to only exist in the standard glibc but at least not in bionic.
Replace the two strdupa calls we have by a standard strdup.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
caps.h: Rename __errno to ___errno

At least bionic defines __errno, so this was causing a conflict in caps.h
leading to build failure. Renaming to ___errno avoids that duplicate
definition.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
conf.c: Cleanup __S_ISTYPE

__S_ISTYPE doesn't exist in all C libraries, so define it if it's missing.
Additionaly, replace one occurence where it wasn't actually needed.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
lxc_unshare: Replace getpw*_r by getpw*

Bionic and maybe some other libc implementations lack the _r nss functions.
This replaces our current getpwnam_r and getpwuid_r calls by getpwnam and
getpwuid.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
utmp.c: Avoid duplicate definition of __USE_GNU

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
tests/Makefile.am: Update for bionic

-lpthread doesn't exist and isn't necessary on bionic.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
Don't call setup_mount_entries if the list is empty

There's no good reason to call setup_mount_entries if we don't have any
lxc.mount.entry. This also avoids an issue on bionic where the tmpfile()
call in setup_mount_entries requires the presence of /tmp which isn't the
case by default.

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>
create rslave chroot any time pivot_root fails with -EINVAL

Note we still need the function to detect a MS_SHARED /, bc
if we detect that then we need to umount the chroot tmpfs
mount which lxc-start created, whose mount was forwarded to
the host mounts namespace.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
Makefile.am: Add missing liblxc symlink

Signed-off-by: Stéphane Graber <stgraber@ubuntu.com>