From 67fb8cb9a157931c94bb420f25c36d55c2876d02 Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Mon, 10 Jun 2019 22:59:08 +0200 Subject: [PATCH] nss: gr/pw: re-used variable Now that the key argument is const we can use this to reduces code duplication. --- nss/gr.c | 2 +- nss/pw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nss/gr.c b/nss/gr.c index cc7f9b0..d8d6d6a 100644 --- a/nss/gr.c +++ b/nss/gr.c @@ -165,7 +165,7 @@ static enum nss_status internal_getgr(struct search_key *key, struct group *resu return NSS_STATUS_NOTFOUND; } - const char *e = h->data + h->off_data + *off; + const char *e = key->data + *off; if (!entry_to_group((struct group_entry *)e, result, buffer, buflen)) { unmap_file(&f); errno = ERANGE; diff --git a/nss/pw.c b/nss/pw.c index c7e0566..c772bb1 100644 --- a/nss/pw.c +++ b/nss/pw.c @@ -151,7 +151,7 @@ static enum nss_status internal_getpw(struct search_key *key, struct passwd *res return NSS_STATUS_NOTFOUND; } - const char *e = h->data + h->off_data + *off; + const char *e = key->data + *off; if (!entry_to_passwd((struct passwd_entry *)e, result, buffer, buflen)) { unmap_file(&f); errno = ERANGE; -- 2.45.2