From 91e4e2403e950d06eb49840bdb11409321002847 Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Sat, 2 May 2020 21:34:10 +0900 Subject: internal/process.h: add a no-warning simple wrapper for fork(2) As fork(2) is deprecated, its calls must be guarded by `COMPILER_WARNING_IGNORED(-Wdeprecated-declarations)`. All usages of fork(2) in process have been alread guarded. A new call to fork(2) was added in ruby.c with f22c4ff359498ab342e4b6d6feb21af6004ee270. This caused a build failure on Solaris 11. It may hide a bug to guard big code unnecessarily, so this change introduces a simple wrapper "rb_fork" whose definition is guarded, and replaces all calls to fork(2) with the wrapper function. --- ruby.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ruby.c') diff --git a/ruby.c b/ruby.c index 405891f873..f2577f51f1 100644 --- a/ruby.c +++ b/ruby.c @@ -56,6 +56,7 @@ #include "internal/missing.h" #include "internal/object.h" #include "internal/parse.h" +#include "internal/process.h" #include "internal/variable.h" #include "mjit.h" #include "ruby/encoding.h" @@ -1635,7 +1636,7 @@ process_options(int argc, char **argv, ruby_cmdline_options_t *opt) #ifdef HAVE_WORKING_FORK int fds[2]; if (rb_pipe(fds) == 0) { - rb_pid_t pid = fork(); + rb_pid_t pid = rb_fork(); if (pid > 0) { /* exec PAGER with reading from child */ dup2(fds[0], 0); -- cgit v1.2.3