mirror of
https://github.com/systemd/systemd
synced 2024-10-01 13:55:20 +00:00
dev-setup: Follow /dev/console symlinks when locking /dev/console
systemd-nspawn sets up /dev/console as a symlink to a pty, so let's make sure we follow the symlink when trying to lock /dev/console so we don't fail with ELOOP.
This commit is contained in:
parent
d91c7c91bf
commit
774eb5dbdd
|
@ -22,7 +22,9 @@ int lock_dev_console(void) {
|
|||
_cleanup_close_ int fd = -EBADF;
|
||||
int r;
|
||||
|
||||
fd = open_terminal("/dev/console", O_RDONLY|O_CLOEXEC|O_NOCTTY|O_NOFOLLOW);
|
||||
/* NB: We do not use O_NOFOLLOW here, because some container managers might place a symlink to some
|
||||
* pty in /dev/console, in which case it should be fine to lock the target TTY. */
|
||||
fd = open_terminal("/dev/console", O_RDONLY|O_CLOEXEC|O_NOCTTY);
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
|
|
Loading…
Reference in a new issue