[collectd] [PATCH] unixsock: remove a possible leftover unix socket file before creating
Sebastian Harl
sh at tokkee.org
Wed Mar 24 13:38:58 CET 2010
Hi Peter,
On Wed, Mar 24, 2010 at 01:27:15PM +0100, Peter Warasin wrote:
> 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?
Well, yes -- if it's misconfigured … ;-)
Seriously, though, this is always an error, since no two instances can
listen on the same (UNIX) socket.
> If that is the case probably it is an error and we should print out a
> warning that the file will be removed?
This would be caught by the "mechanism" mentioned below, though.
> > 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?
TIA,
Sebastian
--
Sebastian "tokkee" Harl +++ GnuPG-ID: 0x8501C7FC +++ http://tokkee.org/
Those who would give up Essential Liberty to purchase a little Temporary
Safety, deserve neither Liberty nor Safety. -- Benjamin Franklin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20100324/7f03a85e/attachment.pgp
More information about the collectd
mailing list