Remove socket when closing UDS transport.
[RC: added cast to sockaddr to avoid compiler warning. ] Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
28865f91df
commit
2423357754
8
uds.c
8
uds.c
|
@ -42,6 +42,14 @@ struct uds {
|
||||||
|
|
||||||
static int uds_close(struct transport *t, struct fdarray *fda)
|
static int uds_close(struct transport *t, struct fdarray *fda)
|
||||||
{
|
{
|
||||||
|
struct sockaddr_un sa;
|
||||||
|
socklen_t len = sizeof(sa);
|
||||||
|
|
||||||
|
if (!getsockname(fda->fd[FD_GENERAL], (struct sockaddr *) &sa, &len) &&
|
||||||
|
sa.sun_family == AF_LOCAL) {
|
||||||
|
unlink(sa.sun_path);
|
||||||
|
}
|
||||||
|
|
||||||
close(fda->fd[FD_GENERAL]);
|
close(fda->fd[FD_GENERAL]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue