diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2013-01-26 00:16:13 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2013-01-26 00:16:13 +0100 |
commit | f2956e80c99cd41ca6bbbe41b09e01b234ca8778 (patch) | |
tree | 3658e3a1e80f6514cc8687e98fffb4c79ba9ad76 /src/nspawn | |
parent | e45460d666512db4f908f86e8722d7932dcf0f82 (diff) |
nspawn: assume stdout is always writable if it does not support epoll
stdout can be redirected to a regular file. Regular files don't support epoll.
nspawn failed with: "Failed to register fds in epoll: Operation not permitted".
If stdout does not support epoll, assume it's always writable.
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 62dc20d824..4c8737132b 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -885,8 +885,17 @@ static int process_pty(int master, pid_t pid, sigset_t *mask) { signal_ev.events = EPOLLIN; signal_ev.data.fd = signal_fd; - if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0 || - epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 || + if (epoll_ctl(ep, EPOLL_CTL_ADD, STDOUT_FILENO, &stdout_ev) < 0) { + if (errno != EPERM) { + log_error("Failed to register stdout in epoll: %m"); + r = -errno; + goto finish; + } + /* stdout without epoll support. Likely redirected to regular file. */ + stdout_writable = true; + } + + if (epoll_ctl(ep, EPOLL_CTL_ADD, master, &master_ev) < 0 || epoll_ctl(ep, EPOLL_CTL_ADD, signal_fd, &signal_ev) < 0) { log_error("Failed to register fds in epoll: %m"); r = -errno; |