minor bugs and structure questions..

Branko Cibej branko.cibej at hermes.si
Wed May 5 16:04:33 GMT 1999


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