public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/siddhesh/gai-cleanup2] gaih_inet: Discard result on action == continue
@ 2022-02-22 14:56 Siddhesh Poyarekar
  0 siblings, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-02-22 14:56 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=2bf5fe0fcc6642da343e56ad6de69d8ce717f5ed

commit 2bf5fe0fcc6642da343e56ad6de69d8ce717f5ed
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Tue Feb 22 20:26:00 2022 +0530

    gaih_inet: Discard result on action == continue
    
    Currently this acts the same as merge, which is incorrect.

Diff:
---
 sysdeps/posix/getaddrinfo.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index c4f48acfd0..dbd0f4e05b 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -849,6 +849,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (req->ai_family == PF_UNSPEC)
 	    fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
 
+	  struct gaih_addrtuple **old_pat = pat;
+
 	  if (fct4 != NULL)
 	    {
 	      size_t length = 1024;
@@ -1020,6 +1022,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
 	    break;
 
+	  /* Discard the previous result on CONTINUE.  */
+	  if (nss_next_action (nip, status) == NSS_ACTION_CONTINUE)
+	    pat = old_pat;
+
 	  nip++;
 	  if (nip->module == NULL)
 	    no_more = -1;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/siddhesh/gai-cleanup2] gaih_inet: Discard result on action == continue
@ 2022-02-23 10:07 Siddhesh Poyarekar
  0 siblings, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-02-23 10:07 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=e31d7281b0f74e1aa9f2a12427f843e89e814613

commit e31d7281b0f74e1aa9f2a12427f843e89e814613
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Feb 23 13:46:09 2022 +0530

    gaih_inet: Discard result on action == continue
    
    Currently this acts the same as merge, which is incorrect.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 sysdeps/posix/getaddrinfo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 6b6fdef376..c00a86e440 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -869,6 +869,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (req->ai_family == PF_UNSPEC)
 	    fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
 
+	  struct gaih_addrtuple **old_pat = pat;
+
 	  if (fct4 != NULL)
 	    {
 	      size_t length = 1024;
@@ -1040,6 +1042,16 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
 	    break;
 
+	  /* Discard the previous result on CONTINUE.  Allocations will get
+	     freed at the end with func_cleanup, so only adjust PAT and free
+	     CANONBUF if it was allocated.  */
+	  if (nss_next_action (nip, status) == NSS_ACTION_CONTINUE)
+	    {
+	      pat = old_pat;
+	      free (canonbuf);
+	      canon = canonbuf = NULL;
+	    }
+
 	  nip++;
 	  if (nip->module == NULL)
 	    no_more = -1;


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [glibc/siddhesh/gai-cleanup2] gaih_inet: Discard result on action == continue
@ 2022-02-23  9:03 Siddhesh Poyarekar
  0 siblings, 0 replies; 3+ messages in thread
From: Siddhesh Poyarekar @ 2022-02-23  9:03 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=070cdfe102af7fd208132c2bed68623411b47924

commit 070cdfe102af7fd208132c2bed68623411b47924
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Feb 23 13:46:09 2022 +0530

    gaih_inet: Discard result on action == continue
    
    Currently this acts the same as merge, which is incorrect.
    
    Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org>

Diff:
---
 sysdeps/posix/getaddrinfo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 7e087a763e..49b1597f77 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -851,6 +851,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (req->ai_family == PF_UNSPEC)
 	    fct4 = __nss_lookup_function (nip, "gethostbyname4_r");
 
+	  struct gaih_addrtuple **old_pat = pat;
+
 	  if (fct4 != NULL)
 	    {
 	      size_t length = 1024;
@@ -1022,6 +1024,16 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  if (nss_next_action (nip, status) == NSS_ACTION_RETURN)
 	    break;
 
+	  /* Discard the previous result on CONTINUE.  Allocations will get
+	     freed at the end with func_cleanup, so only adjust PAT and free
+	     CANONBUF if it was allocated.  */
+	  if (nss_next_action (nip, status) == NSS_ACTION_CONTINUE)
+	    {
+	      pat = old_pat;
+	      free (canonbuf);
+	      canon = canonbuf = NULL;
+	    }
+
 	  nip++;
 	  if (nip->module == NULL)
 	    no_more = -1;


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-23 10:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-22 14:56 [glibc/siddhesh/gai-cleanup2] gaih_inet: Discard result on action == continue Siddhesh Poyarekar
2022-02-23  9:03 Siddhesh Poyarekar
2022-02-23 10:07 Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).