From 6736e8e785be7eafef44d99a24f4971ea9959ed2 Mon Sep 17 00:00:00 2001 From: "Ghorban M. Tavakoly" Date: Fri, 4 Apr 2025 03:15:13 +0330 Subject: [PATCH] fix: Replace SIGUNUSED and use _GNU_SOURCE The SIGUNUSED define was removed from glibc version 2.26 in August 2017. So Termistor cannot be built on GNU/Linux distributions that use glibc>=2.26, such as Fedora 27 and Ubuntu 17.10. From the [signal(7) man page](https://man7.org/linux/man-pages/man7/signal.7.html): ``` SIGUNUSED - Core Synonymous with SIGSYS ``` After changing `SIGUNSED` to `SIGSYS`, there are other problems raise while building the code: * `grantpt`, `unlockpt` and ptsname functions, needs `_XOPEN_SOURCE >= 500` feature test macro. * `posix_openpt` function needs `_XOPEN_SOURCE >= 600` feature test macro. * `pipe2` function needs `_GNU_SOURCE` feature test macro. Since `_GNU_SOURCE` implies nearly all feature test macros, adding `_GNU_SOURCE` is sufficient. Signed-off-by: Ghorban M. Tavakoly --- CMakeLists.txt | 2 +- libtsm/src/shared/shl-pty.c | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 39cd7ef..6029243 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.5) project(termistor) set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/libtsm/src/shared/shl-pty.c b/libtsm/src/shared/shl-pty.c index 5dfe977..96c769c 100644 --- a/libtsm/src/shared/shl-pty.c +++ b/libtsm/src/shared/shl-pty.c @@ -9,6 +9,8 @@ * PTY Helpers */ +#define _GNU_SOURCE + #include #include #include @@ -146,7 +148,7 @@ static int pty_init_child(int fd) if (r < 0) return -errno; - for (i = 1; i < SIGUNUSED; ++i) + for (i = 1; i < SIGSYS; ++i) signal(i, SIG_DFL); r = grantpt(fd);