main: newer kernels return EINVAL if we invoke reboot() in a container lacking perms, deal with it

This commit is contained in:
Lennart Poettering 2012-09-17 18:28:40 +02:00
parent 669bec5d17
commit c999977392
1 changed files with 3 additions and 2 deletions

View File

@ -138,8 +138,9 @@ static int enable_special_signals(Manager *m) {
assert(m);
/* Enable that we get SIGINT on control-alt-del. In containers
* this will fail with EPERM, so ignore that. */
if (reboot(RB_DISABLE_CAD) < 0 && errno != EPERM)
* this will fail with EPERM (older) or EINVAL (newer), so
* ignore that. */
if (reboot(RB_DISABLE_CAD) < 0 && errno != EPERM && errno != EINVAL)
log_warning("Failed to enable ctrl-alt-del handling: %m");
fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC);