Merge branch 'rs/fix-unlink-unix-socket'
The unix-domain socket used by the sample credential cache daemon tried to unlink an existing stale one at a wrong path, if the path to the socket was given as an overlong path that does not fit in sun_path member of the sockaddr_un structure. * rs/fix-unlink-unix-socket: unix-socket: remove stale socket before calling chdir()
This commit is contained in:
commit
6da748a7ce
@ -99,11 +99,12 @@ int unix_stream_listen(const char *path)
|
|||||||
struct sockaddr_un sa;
|
struct sockaddr_un sa;
|
||||||
struct unix_sockaddr_context ctx;
|
struct unix_sockaddr_context ctx;
|
||||||
|
|
||||||
|
unlink(path);
|
||||||
|
|
||||||
if (unix_sockaddr_init(&sa, path, &ctx) < 0)
|
if (unix_sockaddr_init(&sa, path, &ctx) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
fd = unix_stream_socket();
|
fd = unix_stream_socket();
|
||||||
|
|
||||||
unlink(path);
|
|
||||||
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
|
if (bind(fd, (struct sockaddr *)&sa, sizeof(sa)) < 0)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user