[Tarantool-patches] [PATCH 6/7] popen: handle setsid os specifics
Cyrill Gorcunov
gorcunov at gmail.com
Mon Mar 2 23:12:26 MSK 2020
On linux it is fine to call setsid right after
the vfork, in turn on bsd pgrp should be used.
Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---
src/lib/core/popen.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index 6e5ca21bd..d41e9cfce 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -839,8 +839,15 @@ popen_new(struct popen_opts *opts)
*/
if (opts->flags & POPEN_FLAG_SETSID) {
if (setsid() == -1) {
+#ifndef TARGET_OS_DARWIN
say_syserror("child: setsid failed");
goto exit_child;
+#else
+ if (setpgrp() == -1) {
+ say_syserror("child: setpgrp failed");
+ goto exit_child;
+ }
+#endif
}
}
--
2.20.1
More information about the Tarantool-patches
mailing list