diff options
author | Lennart Poettering <lennart@poettering.net> | 2012-04-13 16:53:49 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2012-04-13 18:52:52 +0200 |
commit | a41b539efce4765c3e7a81ed308610776cc73173 (patch) | |
tree | 0899b5aba16d72c74a215b5b3c23d31494b6de22 /src | |
parent | e58a12770c0c7b9571cc80f487d666151811c1ee (diff) |
manager: support systems lacking /dev/tty0
Diffstat (limited to 'src')
-rw-r--r-- | src/core/manager.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/core/manager.c b/src/core/manager.c index 2801500f90..869c99f5c5 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -141,13 +141,17 @@ static int enable_special_signals(Manager *m) { assert(m); - /* Enable that we get SIGINT on control-alt-del */ - if (reboot(RB_DISABLE_CAD) < 0) + /* 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) log_warning("Failed to enable ctrl-alt-del handling: %m"); - if ((fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) - log_warning("Failed to open /dev/tty0: %m"); - else { + fd = open_terminal("/dev/tty0", O_RDWR|O_NOCTTY|O_CLOEXEC); + if (fd < 0) { + /* Support systems without virtual console */ + if (fd != -ENOENT) + log_warning("Failed to open /dev/tty0: %m"); + } else { /* Enable that we get SIGWINCH on kbrequest */ if (ioctl(fd, KDSIGACCEPT, SIGWINCH) < 0) log_warning("Failed to enable kbrequest handling: %s", strerror(errno)); |