public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Remove unneded setting of errno after malloc failure
@ 2018-05-17 13:35 Andreas Schwab
  2018-05-17 13:38 ` H.J. Lu
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Schwab @ 2018-05-17 13:35 UTC (permalink / raw)
  To: libc-alpha

The errno value has alread been set by malloc.

	* resolv/res_send.c (__res_context_send): Don't set errno when
	returning error after malloc failure.
---
 resolv/res_send.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/resolv/res_send.c b/resolv/res_send.c
index 9e9541789b..947ebf5212 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -472,10 +472,7 @@ __res_context_send (struct resolv_context *ctx,
 					sizeof (struct sockaddr_in6)
 					- sizeof (struct sockaddr_in));
 			else
-			  {
-			    __set_errno (ENOMEM);
-			    return -1;
-			  }
+				return -1;
 		}
 		EXT(statp).nscount = statp->nscount;
 	}
-- 
2.17.0


-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

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

* Re: [PATCH] Remove unneded setting of errno after malloc failure
  2018-05-17 13:35 [PATCH] Remove unneded setting of errno after malloc failure Andreas Schwab
@ 2018-05-17 13:38 ` H.J. Lu
  0 siblings, 0 replies; 2+ messages in thread
From: H.J. Lu @ 2018-05-17 13:38 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: GNU C Library

On Thu, May 17, 2018 at 6:35 AM, Andreas Schwab <schwab@suse.de> wrote:
> The errno value has alread been set by malloc.
>
>         * resolv/res_send.c (__res_context_send): Don't set errno when
>         returning error after malloc failure.
> ---
>  resolv/res_send.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/resolv/res_send.c b/resolv/res_send.c
> index 9e9541789b..947ebf5212 100644
> --- a/resolv/res_send.c
> +++ b/resolv/res_send.c
> @@ -472,10 +472,7 @@ __res_context_send (struct resolv_context *ctx,
>                                         sizeof (struct sockaddr_in6)
>                                         - sizeof (struct sockaddr_in));
>                         else
> -                         {
> -                           __set_errno (ENOMEM);
> -                           return -1;
> -                         }
> +                               return -1;
>                 }
>                 EXT(statp).nscount = statp->nscount;
>         }
> --
> 2.17.0
>

The commit subject should "unneeded", not "unneded".  Otherwise, LGTM.

Thanks.

-- 
H.J.

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

end of thread, other threads:[~2018-05-17 13:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17 13:35 [PATCH] Remove unneded setting of errno after malloc failure Andreas Schwab
2018-05-17 13:38 ` H.J. Lu

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).