From fb0d39dfc31a934d20e470f91260041e257ba82a Mon Sep 17 00:00:00 2001 From: CismonX Date: Tue, 17 Jun 2025 12:24:08 +0800 Subject: [PATCH] defs: remove `HAVE_PIPE2` macro This feature check is only used in `xpipe2()`. --- src/defs.h | 4 ---- src/xstd.c | 6 +++--- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/defs.h b/src/defs.h index dbb2020..33b0ce7 100644 --- a/src/defs.h +++ b/src/defs.h @@ -92,10 +92,6 @@ # define UNUSED_VAR(name) name##_unused_ VARATTR_UNUSED_ #endif /* defined(HAVE_STDC_23) */ -#if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE)) -# define HAVE_PIPE2 1 -#endif - #ifndef __FreeBSD__ # define O_RESOLVE_BENEATH 0 # define PROT_MAX(prot) 0 diff --git a/src/xstd.c b/src/xstd.c index d815644..e4b5053 100644 --- a/src/xstd.c +++ b/src/xstd.c @@ -111,14 +111,14 @@ xpipe2 ( int pipefd[2], int flags ) { -#ifdef HAVE_PIPE2 +#if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE)) if (0 != pipe2(pipefd, flags)) { log_printf("pipe2(): %s", xstrerror(errno)); return -1; } return 0; -#else /* !defined(HAVE_PIPE2) */ +#else if (0 != pipe(pipefd)) { log_printf("pipe(): %s", xstrerror(errno)); return -1; @@ -147,7 +147,7 @@ xpipe2 ( close(pipefd[1]); return -1; -#endif /* defined(HAVE_PIPE2) */ +#endif } void *