This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid downloading whole NIS services.by{,service}name for getservby{name,port}{,_r} (, NULL)


On Mon, Mar 29, Jakub Jelinek wrote:

> Hi!
> 
> Only lightly tested so far.
> It is not neccessary to download, allocate and copy whole services
> map and then search through it.
> Instead, we can search already in the foreach callback and if we find
> something tell the caller we don't need further input.
> 
> BTW: __xdr_ypresp_all uses the foreach callback return value as
> 0 -> need further data, != 0 break the loop.
> But saveit callbacks I see return 0 when further data should be
> examined and YP_FALSE (== 0) on error (e.g. memory failures).
> This certainly doesn't sound right.

There are two wrong checks:

  if (instatus != YP_TRUE)
    return instatus;

and

      if (newp == NULL)
        return YP_FALSE; /* We have no error code for out of memory */


are both wrong. I will look later at it and try to fix it.
Seems I mixed the instatus and with the return value of the foreach
function.

 Thanks,
  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]