minor bugs and structure questions..

Kevin Stefanik kstef at mtppi.org
Wed May 5 17:28:21 GMT 1999


Right you are.  The comparison should be (f==NULL), and (!f) should be
identical when f is a FILE*, right? 

I was getting error messages in the log that it couldn't open the
username.map file when the comparison was (!f), but now I can't reproduce
it.  I'm going to leave it set at (!f) for a while and see if I find more
errors. It sounds far-fetched, but it may have been an interaction with the
other error.

The compiler I'm using is the default compiler (cc) with DG-UX 4.0D.  

Thanks,
Kevin


> -----Original Message-----
> From:	Branko Cibej [SMTP:branko.cibej at hermes.si]
> Sent:	Wednesday, May 05, 1999 12:07 PM
> To:	Multiple recipients of list
> Subject:	Re: minor bugs and structure questions..
> 
> Kevin Stefanik wrote:
> 
> > In the course of that I found two locations that were comparing the
> return
> > values of file opens to zero, instead of -1 or a defined constant.
> DG-UX
> > seems to return zeroes for valid file handles.  (I thought that this was
> > standard behavior across most systems, but I can't make that statement
> with
> > much authority) Is there a preferred cross-platform mechanism?
> >
> > in lib/username.c:
> >     83   f = sys_fopen(mapfile,"r");
> >     84    if (!f) {
> >     85      DEBUG(0,("can't open username map %s\n",mapfile));
> >     86      return False;
> >     87    }
> 
> Hmm? This looks right: fopen returns a FILE*, so testing for NULL fine (if
> F is
> declared a FILE*, not an int).
> 
> > in smbd/chgpasswd.c:
> >     66  #if defined(HAVE_GRANTPT)
> >     67    if ((master = sys_open("/dev/ptmx", O_RDWR, 0)) >= 1) {
> 
> This should be >=0, yes.
> 
> > I had to change both of these to >=0 comparisons to avoid errors.
> 
> If I were you I'd check the first case again; I believe the fix is wrong.
> 
>     Brane
> 
> --
> Branko Čibej                 <branko.cibej at hermes.si>
> HERMES SoftLab, Litijska 51, 1000 Ljubljana, Slovenia
> voice: (+386 61) 186 53 49   fax: (+386 61) 186 52 70
> 


More information about the samba-technical mailing list