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");
> > >    }
> > >    warn ("Socket already exists but is not connected - unclean
> > >    shutdown?"); unlink (UNIX_SOCKET);
> > > }
> > OK, but this will be an option (something like FixSocket or so) in
> > clamav.conf.
> 
> 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 way (see localserver.c).

> Use open(O_CREAT) to create the file, bind() to try to get exclusive
> access to it, and listen() to begin accepting connections.

There's no need for open(), bind() creates the socket file itself.

Best regards,
Tomasz Kojm
-- 
      oo    .....       [EMAIL PROTECTED]
     (\/)\.........     http://www.konarski.edu.pl/~zolw
        \..........._   I nie zapomnij kliknac w brzuszek... 
          //\   /\\     <- C. Amboinensis    www.pajacyk.pl        


-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0
_______________________________________________
Clamav-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/clamav-users

Reply via email to