aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2014-11-03 18:51:40 -0200
committerAlexandre Oliva <aoliva@redhat.com>2014-11-07 07:18:53 -0200
commitff9a1b7dce77c43235e11cda103698078cf44a45 (patch)
tree4d3a2fde13911850862d3ee695755c15f441219b
parent6286965b02069369beeb893833c34f01dc919ffb (diff)
downloadglibc-ff9a1b7dce77c43235e11cda103698078cf44a45.zip
glibc-ff9a1b7dce77c43235e11cda103698078cf44a45.tar.gz
glibc-ff9a1b7dce77c43235e11cda103698078cf44a45.tar.bz2
Do not continue in nss_db_getservbyname
-rw-r--r--nss/nss_db/db-XXX.c9
-rw-r--r--nss/nss_files/files-service.c7
2 files changed, 11 insertions, 5 deletions
diff --git a/nss/nss_db/db-XXX.c b/nss/nss_db/db-XXX.c
index 89b1a12..e950887 100644
--- a/nss/nss_db/db-XXX.c
+++ b/nss/nss_db/db-XXX.c
@@ -191,6 +191,12 @@ enum nss_status \
char *p = memcpy (buffer, valstr, len); \
\
int err = parse_line (p, result, data, buflen, errnop EXTRA_ARGS); \
+ \
+ /* Advance before break_if_match, lest it uses continue to skip
+ to the next entry. */ \
+ if ((hidx += hval2) >= header->dbs[i].hashsize) \
+ hidx -= header->dbs[i].hashsize; \
+ \
if (err > 0) \
{ \
status = NSS_STATUS_SUCCESS; \
@@ -203,9 +209,6 @@ enum nss_status \
status = NSS_STATUS_TRYAGAIN; \
break; \
} \
- \
- if ((hidx += hval2) >= header->dbs[i].hashsize) \
- hidx -= header->dbs[i].hashsize; \
} \
\
if (status == NSS_STATUS_NOTFOUND) \
diff --git a/nss/nss_files/files-service.c b/nss/nss_files/files-service.c
index 2401cb0..c28c62f 100644
--- a/nss/nss_files/files-service.c
+++ b/nss/nss_files/files-service.c
@@ -44,8 +44,11 @@ DB_LOOKUP (servbyname, ':',
{
/* Must match both protocol (if specified) and name. */
if (proto != NULL && strcmp (result->s_proto, proto))
- continue;
- LOOKUP_NAME (s_name, s_aliases)
+ /* A continue statement here breaks nss_db, because it
+ bypasses advancing to the next db entry, and it
+ doesn't make nss_files any more efficient. */;
+ else
+ LOOKUP_NAME (s_name, s_aliases)
},
const char *name, const char *proto)