Skip to content

Commit

Permalink
nbd-client: Fix build on musl + gcc14
Browse files Browse the repository at this point in the history
GCC-14 has promoted incompatible-pointer-types warning into error which is
now flagged especially with when building on musl

Fixes following error

| ../nbd-3.26.1/nbd-client.c: In function 'openunix':
| ../nbd-3.26.1/nbd-client.c:345:27: error: passing argument 2 of 'connect' from incompatible pointer type [-Wincompatible-pointer-types]
|   345 |         if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
|       |                           ^~~~~~~~
|       |                           |
|       |                           struct sockaddr_un *
| In file included from ../nbd-3.26.1/nbd-client.c:25:
| /mnt/b/yoe/master/build/tmp/work/core2-64-yoe-linux-musl/nbd/3.26.1/recipe-sysroot/usr/include/sys/socket.h:386:19: note: expected 'const struct sockaddr *' but argument is of type 'struct sockaddr_un *'
|   386 | int connect (int, const struct sockaddr *, socklen_t);
|       |                   ^~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Khem Raj <[email protected]>
  • Loading branch information
kraj authored and yoe committed Jul 25, 2024
1 parent d294cda commit 4664b8d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nbd-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ int openunix(const char *path) {
return -1;
};

if (connect(sock, &un_addr, sizeof(un_addr)) == -1) {
if (connect(sock, (struct sockaddr*)&un_addr, sizeof(un_addr)) == -1) {
err_nonfatal("CONNECT failed");
close(sock);
return -1;
Expand Down

0 comments on commit 4664b8d

Please sign in to comment.