From 667930de6cd7e6db61a0c787723cfab9e4cba4ef Mon Sep 17 00:00:00 2001 From: Alexander Turenko <alexander.turenko@tarantool.org> Date: Fri, 10 Apr 2020 16:52:45 +0300 Subject: [PATCH] popen: log a reason of close inherited fds failure This information may be useful for debuggging. Part of #4031 Acked-by: Cyrill Gorcunov <gorcunov@gmail.com> --- src/lib/core/popen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c index 30be74a5f0..fddcbae8f3 100644 --- a/src/lib/core/popen.c +++ b/src/lib/core/popen.c @@ -652,6 +652,8 @@ make_pipe(int pfd[2]) * * @a skip_fds is an array of @a nr_skip_fds elements * with descriptors which should be kept opened. + * + * Returns 0 at success, otherwise -1 and set a diag. */ static int close_inherited_fds(int *skip_fds, size_t nr_skip_fds) @@ -1030,7 +1032,8 @@ popen_new(struct popen_opts *opts) } if (opts->flags & POPEN_FLAG_CLOSE_FDS) { - if (close_inherited_fds(skip_fds, nr_skip_fds)) { + if (close_inherited_fds(skip_fds, nr_skip_fds) != 0) { + diag_log(); say_syserror("child: close inherited fds"); goto exit_child; } -- GitLab