glibc 2.43 has added a prototype for openat2 which conficts
with the interim prototype from the kernel commits:
* glibc 2.43+r5+g856c426a7534-1
* gcc 15.2.1+r604+g0b99615a8aef-1
```
In file included from /usr/include/bits/fcntl.h:61,
from /usr/include/fcntl.h:35,
from openat2.cc:18:
/usr/include/bits/fcntl-linux.h:484:12: error: conflicting declaration of C function ‘int openat2(int, const char*, const open_how*, long unsigned int)’
484 | extern int openat2 (int __dfd, const char * __filename,
| ^~~~~~~
In file included from openat2.cc:1:
../include/crucible/openat2.h:48:5: note: previous declaration ‘int openat2(int, const char*, open_how*, size_t)’
48 | int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
| ^~~~~~~
In file included from /usr/include/bits/fcntl-linux.h:492:
/usr/include/bits/fcntl-linux-fortify.h:36:1: error: conflicting declaration of C function ‘int openat2(int, const char*, const open_how*, size_t)’
36 | openat2 (int __dfd, const char *__filename, const struct open_how *__how,
| ^~~~~~~
../include/crucible/openat2.h:48:5: note: previous declaration ‘int openat2(int, const char*, open_how*, size_t)’
48 | int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
| ^~~~~~~
make[1]: *** [Makefile:42: openat2.o] Error 1
make[1]: Leaving directory '/data/src/bees/lib'
make: *** [Makefile:35: lib] Error 2
```
Fix by adding the missing `const` on `open_how`.
Fixes: https://github.com/Zygo/bees/issues/333
Signed-off-by: Zygo Blaxell <bees@furryterror.org>
extern "C" {
/// Weak symbol to support libc with no syscall wrapper
-int openat2(int dirfd, const char *pathname, struct open_how *how, size_t size) throw();
+int openat2(int dirfd, const char *pathname, const struct open_how *how, size_t size) throw();
};
int
__attribute__((weak))
-openat2(int const dirfd, const char *const pathname, struct open_how *const how, size_t const size)
+openat2(int const dirfd, const char *const pathname, const struct open_how *const how, size_t const size)
throw()
{
return syscall(SYS_openat2, dirfd, pathname, how, size);