[collectd] [PATCH] unixsock: remove a possible leftover unix socket file before creating

Peter Warasin peter at endian.com
Wed Mar 24 13:27:15 CET 2010


Hi Sebastian

Sebastian Harl wrote:
> On Wed, Mar 24, 2010 at 12:59:04PM +0100, Peter Warasin wrote:
>> I wonder if there's a good reason why this has been commented out, and
>> if it can be unlink()'d safely, without side-effects?
> 
> Well, we cannot be sure that the socket file was created by some other
> instance of collectd before. So, since collectd is usually running with
> root privileges, we could possibly remove unrelated data.

Hmm, is there a chance having collectd running multiple times using the
same socket file?
If that is the case probably it is an error and we should print out a
warning that the file will be removed?


> 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.

Thank's

peter

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

:: peter warasin
:: http://www.endian.com   :: peter at endian.com



More information about the collectd mailing list