[Tarantool-patches] [PATCH v2 6/7] popen: handle setsid os specifics
Cyrill Gorcunov
gorcunov at gmail.com
Fri Mar 6 17:30:47 MSK 2020
Due to os specifics we can't call setsid after
vfork on macos (vfork is not longer a part of
posix btw). Thus lets simply ignore it.
If there gonna be a strong need to drop
controlling terminal (we could use ioctl)
or setup new group we will enhance it.
But only if really needed.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
I pushed the new series into
gorcunov/gh-4031-popen-fixup-2
src/lib/core/popen.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index 6e5ca21bd..40da05b52 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -833,9 +833,11 @@ popen_new(struct popen_opts *opts)
if (opts->flags & POPEN_FLAG_RESTORE_SIGNALS)
signal_reset();
+#ifndef TARGET_OS_DARWIN
/*
- * We have to be a session leader otherwise
- * won't be able to kill a group of children.
+ * Note that on MacOS we're not allowed to
+ * set sid after vfork (it is OS specific)
+ * thus simply ignore this flag.
*/
if (opts->flags & POPEN_FLAG_SETSID) {
if (setsid() == -1) {
@@ -843,6 +845,7 @@ popen_new(struct popen_opts *opts)
goto exit_child;
}
}
+#endif
if (opts->flags & POPEN_FLAG_CLOSE_FDS) {
if (close_inherited_fds(skip_fds, nr_skip_fds)) {
--
2.20.1
More information about the Tarantool-patches
mailing list