aports/testing/dbus-broker/gcc14.patch

47 lines
1.8 KiB
Diff

Fix -Wincompatible-pointer-type errors with gcc 14.
```
../src/util/test-sockopt.c: In function 'create_server':
../src/util/test-sockopt.c:31:22: error: passing argument 2 of 'bind' from
incompatible pointer type [-Wincompatible-pointer-types]
31 | r = bind(fd, &address, offsetof(struct sockaddr_un, sun_path));
| ^~~~~~~~
| |
| struct sockaddr_un *
In file included from /usr/include/fortify/sys/socket.h:23,
from ../src/util/test-sockopt.c:8:
/usr/include/sys/socket.h:385:16: note: expected 'const struct sockaddr *' but
argument is of type 'struct sockaddr_un *'
385 | int bind (int, const struct sockaddr *, socklen_t);
| ^~~~~~~~~~~~~~~~~~~~~~~
```
--- dbus-broker-36-origin/src/util/test-sockopt.c
+++ dbus-broker-36/src/util/test-sockopt.c
@@ -28,7 +28,7 @@
struct sockaddr_un address = { .sun_family = AF_UNIX };
int r;
- r = bind(fd, &address, offsetof(struct sockaddr_un, sun_path));
+ r = bind(fd, (const struct sockaddr *) &address, offsetof(struct sockaddr_un, sun_path));
c_assert(r >= 0);
r = listen(fd, 256);
@@ -46,7 +46,7 @@
fd = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
c_assert(fd >= 0);
- r = connect(fd, address, n_address);
+ r = connect(fd, (const struct sockaddr *) address, n_address);
c_assert(r >= 0);
*fdp = fd;
@@ -161,7 +161,7 @@
c_assert(l == 1 && c == '!');
n_address = sizeof(address);
- r = getsockname(fd_server, &address, &n_address);
+ r = getsockname(fd_server, (struct sockaddr * restrict) &address, &n_address);
c_assert(r >= 0);
/*