unlink the socket before bind()

If a unix domain socket already exists, bind() fails.  Unlink the
socket file.

git-svn-id: https://svn.musicpd.org/mpd/trunk@7335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Max Kellermann 2008-04-12 04:20:56 +00:00 committed by Eric Wong
parent 3919a87525
commit 91b43b481d

View File

@ -178,6 +178,8 @@ static void parseListenConfigParam(unsigned int port, ConfigParam * param)
if (path_length >= sizeof(sun.sun_path))
FATAL("unix socket path is too long\n");
unlink(param->value);
sun.sun_family = AF_UNIX;
memcpy(sun.sun_path, param->value, path_length + 1);