Remove unneded setting of errno after malloc failure

Message ID mvm36yqxv4k.fsf@suse.de
State New
Headers show
Series
  • Remove unneded setting of errno after malloc failure
Related show

Commit Message

Andreas Schwab May 17, 2018, 1:35 p.m.
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(-)

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

Comments

H.J. Lu May 17, 2018, 1:38 p.m. | #1
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.

Patch

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;
 	}