aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-07-31 16:13:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-07-31 16:13:00 +0000
commit1da8142f324d6011a60c19b77be24a6faf00180e (patch)
treeb318118381ba62b98a7d574fa0ee5ffb4feac483
parentslave: user-notifications: don't block in write(3) (diff)
slave: restore pts file status flags after emitting user-notifications
We (need to) set O_NONBLOCK on the pts file description before emitting the user-notifications, to ensure we don't block in write(3). However, since file status flags are per *file*, not per file *descriptor*, this ends up setting O_NONBLOCK on the dup:ed stdin/stdout/stderr file descriptors too. Not all clients want this, or can handle this. Thus we need to restore the original flags before exec:ing the client. This fixes "makepkg" build failures.
-rw-r--r--slave.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/slave.c b/slave.c
index e8f9ccc7..72a465a8 100644
--- a/slave.c
+++ b/slave.c
@@ -202,10 +202,12 @@ slave_exec(int ptmx, char *argv[], int err_fd, bool login_shell,
goto err;
if (fcntl(pts, F_SETFL, flags | O_NONBLOCK) < 0)
goto err;
- }
- if (!emit_notifications(pts, notifications))
- goto err;
+ if (!emit_notifications(pts, notifications))
+ goto err;
+
+ fcntl(pts, F_SETFL, flags);
+ }
close(pts);
pts = -1;