defs: remove HAVE_PIPE2 macro

This feature check is only used in `xpipe2()`.
This commit is contained in:
CismonX 2025-06-17 12:24:08 +08:00
parent 99ac2b79f8
commit fb0d39dfc3
No known key found for this signature in database
GPG key ID: 3094873E29A482FB
2 changed files with 3 additions and 7 deletions

View file

@ -92,10 +92,6 @@
# define UNUSED_VAR(name) name##_unused_ VARATTR_UNUSED_ # define UNUSED_VAR(name) name##_unused_ VARATTR_UNUSED_
#endif /* defined(HAVE_STDC_23) */ #endif /* defined(HAVE_STDC_23) */
#if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE))
# define HAVE_PIPE2 1
#endif
#ifndef __FreeBSD__ #ifndef __FreeBSD__
# define O_RESOLVE_BENEATH 0 # define O_RESOLVE_BENEATH 0
# define PROT_MAX(prot) 0 # define PROT_MAX(prot) 0

View file

@ -111,14 +111,14 @@ xpipe2 (
int pipefd[2], int pipefd[2],
int flags int flags
) { ) {
#ifdef HAVE_PIPE2 #if defined(__FreeBSD__) || (defined(__linux__) && defined(_GNU_SOURCE))
if (0 != pipe2(pipefd, flags)) { if (0 != pipe2(pipefd, flags)) {
log_printf("pipe2(): %s", xstrerror(errno)); log_printf("pipe2(): %s", xstrerror(errno));
return -1; return -1;
} }
return 0; return 0;
#else /* !defined(HAVE_PIPE2) */ #else
if (0 != pipe(pipefd)) { if (0 != pipe(pipefd)) {
log_printf("pipe(): %s", xstrerror(errno)); log_printf("pipe(): %s", xstrerror(errno));
return -1; return -1;
@ -147,7 +147,7 @@ xpipe2 (
close(pipefd[1]); close(pipefd[1]);
return -1; return -1;
#endif /* defined(HAVE_PIPE2) */ #endif
} }
void * void *