diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2015-08-18 14:41:24 -0400 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2017-03-14 10:18:46 +0100 |
commit | 21fa96e9227e2438f44de929ee6787ad32360c16 (patch) | |
tree | 94d3261b6e2f85d09c9d051acca35df3e9ec2f05 /src/login | |
parent | 0c97084037af1abbae8949c76b1706d88cfdfb86 (diff) |
logind: use open_terminal() instead of open()
The open_terminal() function adds retries in case a terminal
is in the process of being closed when we open it, and should
generally be used to open a terminal. We especially need it
for code that a subsequent commit adds that reopens the terminal
at session shut-down time; such races would be more likely in
that case.
Found by Ray Strode.
Diffstat (limited to 'src/login')
-rw-r--r-- | src/login/logind-session.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 39eab7183..70a93c689 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -981,7 +981,7 @@ static int session_open_vt(Session *s) { return s->vtfd; sprintf(path, "/dev/tty%u", s->vtnr); - s->vtfd = open(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY); + s->vtfd = open_terminal(path, O_RDWR | O_CLOEXEC | O_NONBLOCK | O_NOCTTY); if (s->vtfd < 0) return log_error_errno(errno, "cannot open VT %s of session %s: %m", path, s->id); |