diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 00:03:41 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-05-10 00:03:41 +0000 |
commit | e7c8359e431ef305fbc61e4b86af6353b4f39879 (patch) | |
tree | aaaa18bbbddec4ffe6935c2e14c71d866b0fe7f6 /nis/nss_nis/nis-service.c | |
parent | be434a72b023edab7851c13da8f0639e46ee4fa8 (diff) | |
download | glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.gz glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.tar.xz glibc-e7c8359e431ef305fbc61e4b86af6353b4f39879.zip |
* posix/wordexp.c (w_addword): Free word if realloc fails and it
was allocated here. [Coverity CID 219] * posix/getconf.c (print_all): Free confstr data after printing. [Coverity CID 218] * sysdeps/posix/getaddrinfo.c (gaih_inet): Free canon string if list allocation fails. [Coverity CID 215] * nss/nsswitch.c (__nss_configure_lookup): Fix loop end condition. [Coverity CID 213] * argp/argp-help.c (hol_entry_cmp): Don't call canon_doc_option if string is NULL. [Coverity CID 212] * argp/Makefile: Add rules to build and run bug-argp1. * argp/bug-argp1.c: New file. * io/ftw.c (ftw_dir): Use __rawmemchr instead of strchr to find end of string. * stdlib/canonicalize.c (__realpath): Likewise. * locale/programs/ld-time.c (time_finish): Don't dereference NULL pointer. [Coverity CID 206] * elf/dl-dst.h (DL_DST_REQUIRED): Be prepared for missing link map in statically linked code. * elf/dl-load.c (_dl_dst_substitute): When replacing ORIGIN in statically built code, be prepared to have no link map. [Coverity CID 205] * argp/argp-help.c (fill_in_uparams): Handle STATE==NULL in dgettext calls. [Coverity CID 204] * argp/argp-help.c (struct uparams): Remove valid member. Change the one user. (uparam_names): Reduce size. Avoid relative relocations. Moved to read-only segment. (fill_in_uparams): Update for new layout. * sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Parameter can be assumed to always be != NULL. [Coverity CID 202] * argp/argp-help.c (hol_entry_help): Remove some dead code [Coverity CID 200]. * nis/nss_nis/nis-service.c (_nss_nis_getservbyport_r): Optimize away a few more unconditional yperr2nss calls. (_nss_nis_getservbyname_r): Likewise.
Diffstat (limited to 'nis/nss_nis/nis-service.c')
-rw-r--r-- | nis/nss_nis/nis-service.c | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/nis/nss_nis/nis-service.c b/nis/nss_nis/nis-service.c index cb728335f9..c0e064d9a4 100644 --- a/nis/nss_nis/nis-service.c +++ b/nis/nss_nis/nis-service.c @@ -280,14 +280,13 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, char *result; int int_len; - enum nss_status status = yperr2nss (yp_match (domain, - "services.byservicename", key, - keylen, &result, &int_len)); + int status = yp_match (domain, "services.byservicename", key, + keylen, &result, &int_len); size_t len = int_len; /* If we found the key, it's ok and parse the result. If not, fall through and parse the complete table. */ - if (__builtin_expect (status == NSS_STATUS_SUCCESS, 1)) + if (__builtin_expect (status == YPERR_SUCCESS, 1)) { if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) { @@ -317,7 +316,7 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, /* Check if it is safe to rely on services.byservicename. */ if (_nsl_default_nss () & NSS_FLAG_SERVICES_AUTHORITATIVE) - return status; + return yperr2nss (status); struct ypall_callback ypcb; struct search_t req; @@ -332,10 +331,10 @@ _nss_nis_getservbyname_r (const char *name, const char *protocol, req.buflen = buflen; req.errnop = errnop; req.status = NSS_STATUS_NOTFOUND; - status = yperr2nss (yp_all (domain, "services.byname", &ypcb)); + status = yp_all (domain, "services.byname", &ypcb); - if (status != NSS_STATUS_SUCCESS) - return status; + if (__builtin_expect (status != YPERR_SUCCESS, 0)) + return yperr2nss (status); return req.status; } @@ -362,14 +361,13 @@ _nss_nis_getservbyport_r (int port, const char *protocol, char *result; int int_len; - enum nss_status status = yperr2nss (yp_match (domain, "services.byname", - key, keylen, &result, - &int_len)); + int status = yp_match (domain, "services.byname", key, keylen, &result, + &int_len); size_t len = int_len; /* If we found the key, it's ok and parse the result. If not, fall through and parse the complete table. */ - if (status == NSS_STATUS_SUCCESS) + if (__builtin_expect (status == YPERR_SUCCESS, 1)) { if (__builtin_expect ((size_t) (len + 1) > buflen, 0)) { @@ -414,11 +412,10 @@ _nss_nis_getservbyport_r (int port, const char *protocol, req.buflen = buflen; req.errnop = errnop; req.status = NSS_STATUS_NOTFOUND; - enum nss_status status = yperr2nss (yp_all (domain, "services.byname", - &ypcb)); + int status = yp_all (domain, "services.byname", &ypcb); - if (status != NSS_STATUS_SUCCESS) - return status; + if (__builtin_expect (status != YPERR_SUCCESS, 0)) + return yperr2nss (status); return req.status; } |