aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--slave.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/slave.c b/slave.c
index 1f70a0d8..cc41f39a 100644
--- a/slave.c
+++ b/slave.c
@@ -127,6 +127,15 @@ slave_spawn(int ptmx, int argc, char *const *argv,
return -1;
} else
LOG_DBG("%s: successfully started", conf_shell);
+
+ int fd_flags;
+ if ((fd_flags = fcntl(ptmx, F_GETFD)) < 0 ||
+ fcntl(ptmx, F_SETFD, fd_flags | FD_CLOEXEC) < 0)
+ {
+ LOG_ERRNO("failed to set FD_CLOEXEC on ptmx");
+ return -1;
+ }
+
break;
}
}