nmbd.c open_sockets() have wonder initialization.

Tim Potter tpot at linuxcare.com.au
Thu Nov 9 00:11:03 GMT 2000


Michael Ju. Tokarev writes:

> []
> > +        if ( ClientNMB == -1 ) {
> []
> > +    if ( ClientDGRAM == -1 ) {
> []
> I was always curious in such places -- why to check with -1?
> Why not to use
> 
>   if ( fd < 0 ) {
> 
> (and the same for all other routines etc etc).
> Less typing (two extra chars :)) and _a bit_ efficient
> code...

Well basically because the manual page (and the POSIX spec) says
that all these functions return -1, not any number less than
zero, on failure.


Tim.





More information about the samba-technical mailing list