aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-04-12 04:20:56 +0000
committerEric Wong <normalperson@yhbt.net>2008-04-12 04:20:56 +0000
commit91b43b481dfab06de99a715c2e69f4c14c780abc (patch)
tree0ab9517c2eb5dd51e6fd5b5d92cdbe3d8c23d9e1
parent3919a87525f53f4b2d9a30fbe5e8573e2aba822b (diff)
downloadmpd-91b43b481dfab06de99a715c2e69f4c14c780abc.tar.gz
mpd-91b43b481dfab06de99a715c2e69f4c14c780abc.tar.xz
mpd-91b43b481dfab06de99a715c2e69f4c14c780abc.zip
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
Diffstat (limited to '')
-rw-r--r--src/listen.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/listen.c b/src/listen.c
index cf4628c07..2b9b38619 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -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);