diff options
| author | Kartik Naik <kartik@bugqore.com> | 2026-08-01 00:29:46 +0530 |
|---|---|---|
| committer | Kartik Naik <kartik@bugqore.com> | 2026-08-01 00:29:46 +0530 |
| commit | 4445467b5ce6d39478918d17fe117511935452c0 (patch) | |
| tree | 94274ddf90e2c9cf90c6f3c176e25c31439b8482 | |
| parent | 3c46654fb6b3082e2835d6250320fa9cdd50a077 (diff) | |
| download | portable-4445467b5ce6d39478918d17fe117511935452c0.tar.gz portable-4445467b5ce6d39478918d17fe117511935452c0.tar.bz2 portable-4445467b5ce6d39478918d17fe117511935452c0.zip | |
don't override pledge and unveil when the host provides them
| -rw-r--r-- | CMakeLists.txt | 10 | ||||
| -rw-r--r-- | include/compat/unistd.h | 5 | ||||
| -rw-r--r-- | m4/check-libc.m4 | 2 |
3 files changed, 16 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4ffe67b..cae3cb9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -343,6 +343,16 @@ if(HAVE_GETPROGNAME) | |||
| 343 | add_definitions(-DHAVE_GETPROGNAME) | 343 | add_definitions(-DHAVE_GETPROGNAME) |
| 344 | endif() | 344 | endif() |
| 345 | 345 | ||
| 346 | check_symbol_exists(pledge "unistd.h" HAVE_PLEDGE) | ||
| 347 | if(HAVE_PLEDGE) | ||
| 348 | add_definitions(-DHAVE_PLEDGE) | ||
| 349 | endif() | ||
| 350 | |||
| 351 | check_symbol_exists(unveil "unistd.h" HAVE_UNVEIL) | ||
| 352 | if(HAVE_UNVEIL) | ||
| 353 | add_definitions(-DHAVE_UNVEIL) | ||
| 354 | endif() | ||
| 355 | |||
| 346 | check_symbol_exists(syslog_r "syslog.h;stdarg.h" HAVE_SYSLOG_R) | 356 | check_symbol_exists(syslog_r "syslog.h;stdarg.h" HAVE_SYSLOG_R) |
| 347 | if(HAVE_SYSLOG_R) | 357 | if(HAVE_SYSLOG_R) |
| 348 | add_definitions(-DHAVE_SYSLOG_R) | 358 | add_definitions(-DHAVE_SYSLOG_R) |
diff --git a/include/compat/unistd.h b/include/compat/unistd.h index 544cb27..0ce66dd 100644 --- a/include/compat/unistd.h +++ b/include/compat/unistd.h | |||
| @@ -75,8 +75,13 @@ int getentropy(void *buf, size_t buflen); | |||
| 75 | int getpagesize(void); | 75 | int getpagesize(void); |
| 76 | #endif | 76 | #endif |
| 77 | 77 | ||
| 78 | #ifndef HAVE_PLEDGE | ||
| 78 | #define pledge(request, paths) 0 | 79 | #define pledge(request, paths) 0 |
| 80 | #endif | ||
| 81 | |||
| 82 | #ifndef HAVE_UNVEIL | ||
| 79 | #define unveil(path, permissions) 0 | 83 | #define unveil(path, permissions) 0 |
| 84 | #endif | ||
| 80 | 85 | ||
| 81 | #ifndef HAVE_PIPE2 | 86 | #ifndef HAVE_PIPE2 |
| 82 | int pipe2(int fildes[2], int flags); | 87 | int pipe2(int fildes[2], int flags); |
diff --git a/m4/check-libc.m4 b/m4/check-libc.m4 index eec3cb3..42867cc 100644 --- a/m4/check-libc.m4 +++ b/m4/check-libc.m4 | |||
| @@ -61,7 +61,7 @@ AM_CONDITIONAL([HAVE_SYSLOG_R], [test "x$ac_cv_func_syslog_r" = xyes]) | |||
| 61 | ]) | 61 | ]) |
| 62 | 62 | ||
| 63 | AC_DEFUN([CHECK_SYSCALL_COMPAT], [ | 63 | AC_DEFUN([CHECK_SYSCALL_COMPAT], [ |
| 64 | AC_CHECK_FUNCS([accept4 pipe2 pledge poll socketpair]) | 64 | AC_CHECK_FUNCS([accept4 pipe2 pledge poll socketpair unveil]) |
| 65 | AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes]) | 65 | AM_CONDITIONAL([HAVE_ACCEPT4], [test "x$ac_cv_func_accept4" = xyes]) |
| 66 | AM_CONDITIONAL([HAVE_PIPE2], [test "x$ac_cv_func_pipe2" = xyes]) | 66 | AM_CONDITIONAL([HAVE_PIPE2], [test "x$ac_cv_func_pipe2" = xyes]) |
| 67 | AM_CONDITIONAL([HAVE_PLEDGE], [test "x$ac_cv_func_pledge" = xyes]) | 67 | AM_CONDITIONAL([HAVE_PLEDGE], [test "x$ac_cv_func_pledge" = xyes]) |
