[collectd] [PATCH] unixsock: handle stale socket file

Peter Warasin peter at endian.com
Wed Mar 24 19:03:16 CET 2010


Hi Sebastian

Sebastian Harl wrote:
>> Hmm, is there a chance having collectd running multiple times using the
>> same socket file?
> 
> Well, yes -- if it's misconfigured … ;-)

heh, ok. great :)


>>> At the very least (imho), we should check if that file is a UNIX socket,
>>> and possibly (I'm not sure if that's possible [in a portable way]) check
>>> if the socket is not in use. If both of that is the case, we can be
>>> fairly sure that removing the file is safe.
>> Ok, i understand. That makes sense.
> 
> Are you willing to give that a try and provide a patch?

Sure..

The attached patch handles stale socket files and removes only if it is
a socket and it is not possible to connect() to it. Code is borrowed
from clamav :)

I'm not sure if the stat check is portable enough (manual says it is not
in POSIX.1-1996).

kind regards,
peter

-- 
:: e n d i a n
:: open source - open minds

:: peter warasin
:: http://www.endian.com   :: peter at endian.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd-4.9.1-unixsock-handlestalesocket.patch
Type: text/x-patch
Size: 2661 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100324/02b0caea/attachment-0001.bin 


More information about the collectd mailing list