Unlink of files bound to sockets
by Grüninger, Andreas (LGL Extern)
In qb_ipcc_us_sock_close nd qb_ipcs_us_withdraw of lib/ipc_setup.c sockets are closed.
Is there a reason why the files bound to the sockets are not deleted with unlink?
Is unlinking not necessary with Linux?
I found thousands of files in statedir=/var/corosync/run
I tried this and it seems to work without errors.
void
qb_ipcc_us_sock_close(int32_t sock)
{
#ifdef QB_SOLARIS
struct sockaddr_un un_addr;
socklen_t un_addr_len = sizeof(struct sockaddr_un);
#endif
shutdown(sock, SHUT_RDWR);
#ifdef QB_SOLARIS
if (getsockname(sock, (struct sockaddr *)&un_addr, &un_addr_len) == 0) {
if(strstr(un_addr.sun_path,"-") != NULL) {
qb_util_log(LOG_DEBUG, "un_addr.sun_path=%s", un_addr.sun_path);
unlink(un_addr.sun_path);
}
} else {
qb_util_log(LOG_DEBUG, "getsockname returned errno=%d", errno);
}
#endif
close(sock);
}
Regards
Andreas