On Tue, Mar 04, 2025 at 12:21:19PM +0000, Luis Henriques wrote: > The usage of variable 'myAddr' (struct sockaddr_in) is being casted into a > 'struct sockaddr' when used with bind() and with connect(). This patch > adds that cast when used with getsockname() as well, otherwise we'll get the > following error: > > locktest.c: In function 'main': > locktest.c:1155:39: error: passing argument 2 of 'getsockname' from incompatible pointer type [-Wincompatible-pointer-types] > 1155 | if (getsockname(s_fd, &myAddr, &addr_len)) { > | ^~~~~~~ > | | > | struct sockaddr_in * > In file included from /usr/include/fortify/sys/socket.h:23, > from locktest.c:19: > /usr/include/sys/socket.h:391:23: note: expected 'struct sockaddr * restrict' but argument is of type 'struct sockaddr_in *' > 391 | int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict); > | ^ > > Signed-off-by: Luis Henriques <luis@xxxxxxxxxx> > ---