mirror of
https://salsa.debian.org/ha-team/libqb
synced 2026-08-09 22:49:43 +00:00
ipc: Fix named socket unlink on FreeBSD
Terminating NUL on FreeBSD is not part of the sun_path. Add it to use sun_path as a parameter of unlink. Signed-off-by: Jan Friesse <jfriesse@redhat.com>
This commit is contained in:
parent
d5adc0cbc8
commit
ed29f84ab6
@ -600,6 +600,13 @@ qb_ipcs_us_withdraw(struct qb_ipcs_service * s)
|
||||
socklen_t socklen = sizeof(sockname);
|
||||
if ((getsockname(s->server_sock, (struct sockaddr *)&sockname, &socklen) == 0) &&
|
||||
sockname.sun_family == AF_UNIX) {
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_UN_SUN_LEN
|
||||
/*
|
||||
* Terminating NUL on FreeBSD is not part of the sun_path.
|
||||
* Add it to use sun_path as a parameter of unlink
|
||||
*/
|
||||
sockname.sun_path[sockname.sun_len - offsetof(struct sockaddr_un, sun_path)] = '\0';
|
||||
#endif
|
||||
unlink(sockname.sun_path);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user