[PATCH] Avoid downloading whole NIS services.by{,service}name for getservby{name,port}{,_r} (, NULL)
Thorsten Kukuk
kukuk@suse.de
Tue Mar 30 21:30:00 GMT 2004
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
More information about the Libc-hacker
mailing list