>From 9814f76b8fe272ea4d22beba71e00b8a2a5a59b4 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 25 Jul 2023 15:26:23 +0200 Subject: [PATCH] maint: Fix build failures mingw 10 and MSVC 14.30 * bootstrap.conf (gnulib_modules): Add popen, pclose, readdir, readlinkat, sigaction. * configure.ac: Don't enable _FORTIFY_SOURCE on mingw. * src/util.c (process_signals): If SIGTSTP is not defined, stop_signal_count is zero, therefore disable the stop signal processing. (sig): If SIGHUP is not defined, don't list it. If SIGPIPE is not defined, don't list it. --- bootstrap.conf | 5 +++++ configure.ac | 3 ++- src/util.c | 13 +++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/bootstrap.conf b/bootstrap.conf index 55ff67b..3815596 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -79,15 +79,20 @@ mktime nstrftime nullptr openat +pclose perl +popen progname propername-lite raise rawmemchr +readdir +readlinkat readme-release regex same-inode sh-quote +sigaction signal sigprocmask stat diff --git a/configure.ac b/configure.ac index 1804cb3..19f4c16 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,8 @@ if test $gl_gcc_warnings != no; then AH_VERBATIM([FORTIFY_SOURCE], [/* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ - #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ + #if !defined _FORTIFY_SOURCE && defined __OPTIMIZE__ && __OPTIMIZE__ \ + && !defined __MINGW32__ # define _FORTIFY_SOURCE 2 #endif ]) diff --git a/src/util.c b/src/util.c index 69b7831..b9a0f59 100644 --- a/src/util.c +++ b/src/util.c @@ -266,7 +266,9 @@ process_signals (void) /* Reload stop_signal_count and (if needed) interrupt_signal, in case a new signal was handled before sigprocmask took effect. */ - int stops = stop_signal_count, sig; + int sig; +#ifdef SIGTSTP + int stops = stop_signal_count; /* SIGTSTP is special, since the application can receive that signal more than once. In this case, don't set the signal handler to the @@ -277,6 +279,7 @@ process_signals (void) sig = SIGSTOP; } else +#endif { sig = interrupt_signal; xsignal (sig, SIG_DFL); @@ -305,7 +308,13 @@ static int const sig[] = #ifdef SIGALRM SIGALRM, #endif - SIGHUP, SIGINT, SIGPIPE, +#ifdef SIGHUP + SIGHUP, +#endif + SIGINT, +#ifdef SIGPIPE + SIGPIPE, +#endif #ifdef SIGQUIT SIGQUIT, #endif -- 2.34.1