Skip to content

Commit 7f21202

Browse files
committed
Processing (Unix): better pipe2(2) existance check
1 parent 63cc8e5 commit 7f21202

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,9 @@ endif()
11821182
if(LINUX)
11831183
check_function_exists(statx HAVE_STATX)
11841184
endif()
1185+
if(NOT WIN32)
1186+
check_function_exists(pipe2 HAVE_PIPE2)
1187+
endif()
11851188

11861189
if(ENABLE_SYSTEM_YYJSON)
11871190
find_package(yyjson)
@@ -1296,6 +1299,10 @@ if(HAVE_WCWIDTH)
12961299
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_WCWIDTH)
12971300
endif()
12981301

1302+
if(HAVE_PIPE2)
1303+
target_compile_definitions(libfastfetch PUBLIC FF_HAVE_PIPE2)
1304+
endif()
1305+
12991306
if(NOT "${CUSTOM_PCI_IDS_PATH}" STREQUAL "")
13001307
message(STATUS "Custom file path of pci.ids: ${CUSTOM_PCI_IDS_PATH}")
13011308
target_compile_definitions(libfastfetch PRIVATE FF_CUSTOM_PCI_IDS_PATH=${CUSTOM_PCI_IDS_PATH})

src/common/processing_linux.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232

3333
enum { FF_PIPE_BUFSIZ = 8192 };
3434

35-
static inline int ffPipe2(int *fds, int flags)
35+
static inline int ffPipe2(int* fds, int flags)
3636
{
37-
#ifdef __APPLE__
37+
#ifndef FF_HAVE_PIPE2
3838
if(pipe(fds) == -1)
3939
return -1;
4040
fcntl(fds[0], F_SETFL, fcntl(fds[0], F_GETFL) | flags);

0 commit comments

Comments
 (0)