Package: minissdpd
Version: 1.0-2
Severity: normal
Tags: patch
Hi,
Minissdpd will not start when the unix socket it uses happens to
already exist, even if no other minissdpd is running:
debian:root ~ 108 # killall -9 minissdpd
debian:root ~ 109 # ls /var/run/minissdpd.sock
/var/run/minissdpd.sock
debian:root ~ 110 # /etc/init.d/minissdpd start
Starting UPnP devices daemon: MiniSSDPd.
debian:root ~ 111 # tail /var/log/syslog
[irrelevant (non-minissdpd) lines deleted]
Oct 6 11:55:33 debian minissdpd[17950]: Unable to open pidfile for writing
/var/run/minissdpd.pid: File exists
Oct 6 11:55:33 debian minissdpd[17950]: bind(unixsocket,
"/var/run/minissdpd.sock"): Address already in use
Oct 6 11:55:33 debian minissdpd[17950]: Cannot open unix socket for
communicating with clients. Exiting
debian:root ~ 112 # ps ax | grep minissdpd
17958 pts/4 S+ 0:00 grep minissdpd
I have included a patch to fix this - it removes the socket file (inode)
before doing the bind().
I hereby allow this patch to be included in, and redistributed with, minidsspd
or any derived software using the same license that minissdpd 1.0-2 (as found
in debian on oct 6, 2011) uses.
If this is not sufficient, please ask, and I'll reformulate to something
acceptable.
Regards,
Rogier.
Patch:
----------------------------
diff -aur minissdpd-1.0/minissdpd.c minissdpd-1.0-patch-sockfile/minissdpd.c
--- minissdpd-1.0/minissdpd.c 2008-10-07 14:42:07.000000000 +0200
+++ minissdpd-1.0-patch-sockfile/minissdpd.c 2011-10-06 13:58:39.000000000
+0200
@@ -392,12 +392,20 @@
{
struct sockaddr_un addr;
int s;
+ int rv;
s = socket(AF_UNIX, SOCK_STREAM, 0);
if(s < 0)
{
syslog(LOG_ERR, "socket(AF_UNIX): %m");
return -1;
}
+ rv = unlink(path);
+ if (rv < 0 && errno != ENOENT)
+ {
+ syslog(LOG_ERR, "unlink(unixsocket, \"%s\"): %m", path);
+ close(s);
+ return -1;
+ }
addr.sun_family = AF_UNIX;
strncpy(addr.sun_path, path, sizeof(addr.sun_path));
if(bind(s, (struct sockaddr *)&addr,
----------------------------
-- System Information:
Debian Release: wheezy/sid
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'testing')
Architecture: i386 (x86_64)
Kernel: Linux 2.6.38-2-amd64 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages minissdpd depends on:
ii libc6 2.13-10 Embedded GNU C Library: Shared lib
minissdpd recommends no packages.
minissdpd suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]