Re: [Clamav-users] Clamd Socket Already Exist Error [REPOST]

2003-08-27 Thread Mark Mielke
On Tue, Aug 26, 2003 at 05:53:57PM +0200, Tomasz Kojm wrote: > > As I don't usually do networking in C, and there were one/some style > > complaints: Tomasz, are you accepting the patch as-is? > Of course, I do. However I'd like to see Mark's version and after that > we can update the CVS with the

Re: [Clamav-users] Clamd Socket Already Exist Error [REPOST]

2003-08-26 Thread Tomasz Kojm
> As I don't usually do networking in C, and there were one/some style > complaints: Tomasz, are you accepting the patch as-is? Of course, I do. However I'd like to see Mark's version and after that we can update the CVS with the better one ;) Best regards, Tomasz Kojm -- oo.

Re: [Clamav-users] Clamd Socket Already Exist Error [REPOST]

2003-08-26 Thread Thomas Lamy
ODHIAMBO Washington wrote: * Thomas Lamy <[EMAIL PROTECTED]> [20030825 00:26]: wrote: [..] OK, but this will be an option (something like FixSocket or so) in clamav.conf. Ok, the diff against snapshot 20030823 is attached. The new option is named "FixStaleSocket". No snapshot by that name. Did

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-26 Thread Tomasz Kojm
> Do you need a patch? Mark, all patches are welcome. Please send it to the devel ml and we will check it. Thanks. Best regards, Tomasz Kojm -- oo. [EMAIL PROTECTED] (\/)\. http://www.konarski.edu.pl/~zolw \..._ I nie zapomnij kliknac w brz

Re: [Clamav-users] Clamd Socket Already Exist Error [REPOST]

2003-08-26 Thread ODHIAMBO Washington
* Thomas Lamy <[EMAIL PROTECTED]> [20030825 00:26]: wrote: [..] > >OK, but this will be an option (something like FixSocket or so) in > >clamav.conf. > > > Ok, the diff against snapshot 20030823 is attached. The new option is > named "FixStaleSocket". No snapshot by that name. Did you mean the -

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-26 Thread Tomasz Kojm
> clamd shouldn't be checking whether the file exists. I suspect that simply > removing that check will eliminate the problem. The proposed patch chooses I don't see any race condition there. We simply check if the socket exists just after bind() fails. Best regards, Tomasz Kojm -- oo.

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-25 Thread Mark Mielke
On Sun, Aug 24, 2003 at 02:24:20PM +0200, Tomasz Kojm wrote: > > I believe the proper option is to use the properties of bind() as they > > were intended to be used. bind() should only succeed if no other file > > descriptors in the system are bound to the named UNIX socket. > clamd works in this w

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-25 Thread Tomasz Kojm
On Sat, 23 Aug 2003 20:04:34 -0400 Mark Mielke <[EMAIL PROTECTED]> wrote: > > > What about the following pseudo-code at startup of clamd (instead > > > of failing): > > > if (file exists(UNIX_SOCKET)) { > > >if (connect(UNIX_SOCKET) != ERROR) { > > > die ("Socket already exists"); > > >

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-25 Thread Mark Mielke
On Sun, Aug 24, 2003 at 11:15:34PM +0200, Tomasz Kojm wrote: > On Sun, 24 Aug 2003 15:03:00 -0400 > Mark Mielke <[EMAIL PROTECTED]> wrote: > > This method is much easier, cleaner, contains no race conditions, etc. > I think Thomas patch is just fine. Do you prefer more lines of code, or more relia

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-25 Thread Tomasz Kojm
On Sun, 24 Aug 2003 15:03:00 -0400 Mark Mielke <[EMAIL PROTECTED]> wrote: > This method is much easier, cleaner, contains no race conditions, etc. I think Thomas patch is just fine. Best regards, Tomasz Kojm -- oo. [EMAIL PROTECTED] (\/)\. http://www.konarsk

Re: [Clamav-users] Clamd Socket Already Exist Error [REPOST]

2003-08-24 Thread Thomas Lamy
Tomasz Kojm wrote: On Fri, 22 Aug 2003 22:23:00 +0200 Thomas Lamy <[EMAIL PROTECTED]> wrote: Tomasz Kojm wrote: On Thu, 21 Aug 2003 11:40:29 -0400 "Travis Robertson" <[EMAIL PROTECTED]> wrote: I have tried running clamd in local socket mode. The first time it runs everything is ok, it creates

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-24 Thread Mark Mielke
I believe this is the wrong way of fixing this problem. To prove this, consider the race condition betweens stat(), connect() and bind(). Have you tried the documented method? Window 1: $ perl -e 'use Socket; socket($s, PF_UNIX, SOCK_STREAM, 0) || die "socket: $!\n"; bind($s, sockaddr_un("/tmp/f

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-24 Thread Thomas Lamy
Tomasz Kojm wrote: On Fri, 22 Aug 2003 22:23:00 +0200 Thomas Lamy <[EMAIL PROTECTED]> wrote: Tomasz Kojm wrote: On Thu, 21 Aug 2003 11:40:29 -0400 "Travis Robertson" <[EMAIL PROTECTED]> wrote: I have tried running clamd in local socket mode. The first time it runs everything is ok, it creates

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-24 Thread Mark Mielke
On Sat, Aug 23, 2003 at 08:04:34PM -0400, Mark Mielke wrote: > Use open(O_CREAT) to create the file, bind() to try to get exclusive > access to it, and listen() to begin accepting connections. > This behaviour should not be optional. This behaviour is how it should > have been done all along. > J

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-24 Thread Mark Mielke
On Sat, Aug 23, 2003 at 09:22:08PM +0200, Tomasz Kojm wrote: > On Fri, 22 Aug 2003 22:23:00 +0200 > Thomas Lamy <[EMAIL PROTECTED]> wrote: > > > You should stop clamd cleanly - eg. by sending the SIGTERM signal. > > > Best regards, > > > Tomasz Kojm > > What about the following pseudo-code at start

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-23 Thread Tomasz Kojm
On Fri, 22 Aug 2003 22:23:00 +0200 Thomas Lamy <[EMAIL PROTECTED]> wrote: > Tomasz Kojm wrote: > > On Thu, 21 Aug 2003 11:40:29 -0400 > > "Travis Robertson" <[EMAIL PROTECTED]> wrote: > > > > > >>I have tried running clamd in local socket mode. The first time it > >>runs everything is ok, it cr

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-23 Thread ODHIAMBO Washington
* Thomas Lamy <[EMAIL PROTECTED]> [20030823 11:27]: wrote: > ODHIAMBO Washington wrote: > >* Thomas Lamy <[EMAIL PROTECTED]> [20030823 08:41]: wrote: > >>Tomasz Kojm wrote: > >>>"Travis Robertson" <[EMAIL PROTECTED]> wrote: > I have tried running clamd in local socket mode. The first time it >

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-23 Thread Thomas Lamy
ODHIAMBO Washington wrote: * Thomas Lamy <[EMAIL PROTECTED]> [20030823 08:41]: wrote: Tomasz Kojm wrote: "Travis Robertson" <[EMAIL PROTECTED]> wrote: I have tried running clamd in local socket mode. The first time it runs everything is ok, it creates the /var/run/clamd/clamd.socket. Whenever I r

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-23 Thread ODHIAMBO Washington
* Thomas Lamy <[EMAIL PROTECTED]> [20030823 08:41]: wrote: > Tomasz Kojm wrote: > >On Thu, 21 Aug 2003 11:40:29 -0400 > >"Travis Robertson" <[EMAIL PROTECTED]> wrote: > > > > > >>I have tried running clamd in local socket mode. The first time it > >>runs everything is ok, it creates the /var/run/c

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-22 Thread Thomas Lamy
Tomasz Kojm wrote: On Thu, 21 Aug 2003 11:40:29 -0400 "Travis Robertson" <[EMAIL PROTECTED]> wrote: I have tried running clamd in local socket mode. The first time it runs everything is ok, it creates the /var/run/clamd/clamd.socket. Whenever I reboot the server and it trys to build the socket,

Re: [Clamav-users] Clamd Socket Already Exist Error

2003-08-22 Thread Tomasz Kojm
On Thu, 21 Aug 2003 11:40:29 -0400 "Travis Robertson" <[EMAIL PROTECTED]> wrote: > I have tried running clamd in local socket mode. The first time it > runs everything is ok, it creates the /var/run/clamd/clamd.socket. > Whenever I reboot the server and it trys to build the socket, I get > the e

[Clamav-users] Clamd Socket Already Exist Error

2003-08-21 Thread Travis Robertson
I have tried running clamd in local socket mode.  The first time it runs everything is ok, it creates the /var/run/clamd/clamd.socket.  Whenever I reboot the server and it trys to build the socket, I get the error “ERROR: Socket file /var/run/clamd/clamd.socket already exists.  Please remov