[pacman-dev,3/5] Add an include for signal.h when needed

Message ID 20210417034524.204755-4-mark.weiman@markzz.com
State New
Headers show
Series Various fixes for FreeBSD (and perhaps others) | expand

Commit Message

Mark Weiman April 17, 2021, 3:45 a.m. UTC
On Linux, signal.h is not required to have access to the signal
constants. On FreeBSD, this is not the case and requires signal.h to be
explicitly included.

This patch adds an include for signal.h in any source file that uses it.

Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
---
This is a modified patch that just adds signal.h to required files
instead of adding a check within meson.

 lib/libalpm/util.c | 1 +
 src/pacman/conf.c  | 1 +
 2 files changed, 2 insertions(+)

Comments

Allan McRae April 19, 2021, 7:12 a.m. UTC | #1
On 17/4/21 1:45 pm, Mark Weiman wrote:
> On Linux, signal.h is not required to have access to the signal
> constants. On FreeBSD, this is not the case and requires signal.h to be
> explicitly included.
> 
> This patch adds an include for signal.h in any source file that uses it.
> 
> Signed-off-by: Mark Weiman <mark.weiman@markzz.com>
> ---
> This is a modified patch that just adds signal.h to required files
> instead of adding a check within meson.
> 

Thanks.

A

Patch

diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index b386fde6..46c1d0a1 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -33,6 +33,7 @@ 
 #include <sys/socket.h>
 #include <fnmatch.h>
 #include <poll.h>
+#include <signal.h>
 
 /* libarchive */
 #include <archive.h>
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index a4f2ba35..cde96716 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -31,6 +31,7 @@ 
 #include <sys/utsname.h> /* uname */
 #include <sys/wait.h>
 #include <unistd.h>
+#include <signal.h>
 
 /* pacman */
 #include "conf.h"