ancount = ntohs (hp->ancount);
qdcount = ntohs (hp->qdcount);
cp = answer->buf + HFIXEDSZ;
- if (__builtin_expect (qdcount, 1) != 1)
+ if (__glibc_unlikely (qdcount != 1))
{
*h_errnop = NO_RECOVERY;
return NSS_STATUS_UNAVAIL;
packtmp, sizeof packtmp);
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
{
- if (__builtin_expect (errno, 0) == EMSGSIZE)
+ if (__glibc_unlikely (errno) == EMSGSIZE)
goto too_small;
n = -1;
if (n > 0 && bp[0] == '.')
bp[0] = '\0';
- if (__builtin_expect (n < 0 || ((*name_ok) (bp) == 0 && (errno = EBADMSG)),
- 0))
+ if (__glibc_unlikely (n < 0))
{
*errnop = errno;
*h_errnop = NO_RECOVERY;
return NSS_STATUS_UNAVAIL;
}
+ if (__glibc_unlikely (name_ok (bp) == 0))
+ {
+ errno = EBADMSG;
+ *errnop = EBADMSG;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+ }
cp += n + QFIXEDSZ;
if (qtype == T_A || qtype == T_AAAA)
packtmp, sizeof packtmp);
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
{
- if (__builtin_expect (errno, 0) == EMSGSIZE)
+ if (__glibc_unlikely (errno == EMSGSIZE))
goto too_small;
n = -1;
/* Store alias. */
*ap++ = bp;
n = strlen (bp) + 1; /* For the \0. */
- if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
continue;
n = strlen (tbuf) + 1; /* For the \0. */
if (__glibc_unlikely (n > linebuflen))
goto too_small;
- if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
continue;
n = strlen (tbuf) + 1; /* For the \0. */
if (__glibc_unlikely (n > linebuflen))
goto too_small;
- if (__builtin_expect (n, 0) >= MAXHOSTNAMELEN)
+ if (__glibc_unlikely (n >= MAXHOSTNAMELEN))
{
++had_error;
continue;
packtmp, sizeof packtmp);
if (n != -1 && __ns_name_ntop (packtmp, bp, linebuflen) == -1)
{
- if (__builtin_expect (errno, 0) == EMSGSIZE)
+ if (__glibc_unlikely (errno == EMSGSIZE))
goto too_small;
n = -1;
return NSS_STATUS_SUCCESS;
case T_A:
case T_AAAA:
- if (__builtin_expect (strcasecmp (result->h_name, bp), 0) != 0)
+ if (__glibc_unlikely (strcasecmp (result->h_name, bp) != 0))
{
cp += n;
continue; /* XXX - had_error++ ? */
it later. */
if (n != -1 && __ns_name_ntop (packtmp, buffer, buflen) == -1)
{
- if (__builtin_expect (errno, 0) == EMSGSIZE)
+ if (__glibc_unlikely (errno == EMSGSIZE))
{
too_small:
*errnop = ERANGE;
n = -1;
}
- if (__builtin_expect (n < 0 || (res_hnok (buffer) == 0
- && (errno = EBADMSG)), 0))
+ if (__glibc_unlikely (n < 0))
{
*errnop = errno;
*h_errnop = NO_RECOVERY;
return NSS_STATUS_UNAVAIL;
}
+ if (__glibc_unlikely (res_hnok (buffer) == 0))
+ {
+ errno = EBADMSG;
+ *errnop = EBADMSG;
+ *h_errnop = NO_RECOVERY;
+ return NSS_STATUS_UNAVAIL;
+ }
cp += n + QFIXEDSZ;
int haveanswer = 0;
if (n != -1 &&
(h_namelen = __ns_name_ntop (packtmp, buffer, buflen)) == -1)
{
- if (__builtin_expect (errno, 0) == EMSGSIZE)
+ if (__glibc_unlikely (errno == EMSGSIZE))
goto too_small;
n = -1;
buffer += pad;
buflen = buflen > pad ? buflen - pad : 0;
- if (__builtin_expect (buflen < sizeof (struct gaih_addrtuple),
- 0))
+ if (__glibc_unlikely (buflen < sizeof (struct gaih_addrtuple)))
goto too_small;
*pat = (struct gaih_addrtuple *) buffer;