git: 6e9309bd3b04 - main - libc sctp: improve error reporting of sctp_getladdrs()

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Wed, 01 Dec 2021 10:16:34 UTC
The branch main has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=6e9309bd3b04501b69593900a14e01114c7f2404

commit 6e9309bd3b04501b69593900a14e01114c7f2404
Author:     Michael Tuexen <tuexen@FreeBSD.org>
AuthorDate: 2021-12-01 10:14:36 +0000
Commit:     Michael Tuexen <tuexen@FreeBSD.org>
CommitDate: 2021-12-01 10:14:36 +0000

    libc sctp: improve error reporting of sctp_getladdrs()
    
    Do not hide errno from getsockopt() called internally.
    
    MFC after:      1 week
---
 lib/libc/net/sctp_sys_calls.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/lib/libc/net/sctp_sys_calls.c b/lib/libc/net/sctp_sys_calls.c
index 5acb957c3d3f..3249eeaa4c4e 100644
--- a/lib/libc/net/sctp_sys_calls.c
+++ b/lib/libc/net/sctp_sys_calls.c
@@ -460,7 +460,6 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
 	opt_len = (socklen_t)sizeof(uint32_t);
 	if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE,
 	    &size_of_addresses, &opt_len) != 0) {
-		errno = ENOMEM;
 		return (-1);
 	}
 	if (size_of_addresses == 0) {
@@ -478,7 +477,6 @@ sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
 	if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDRESSES, addrs,
 	    &opt_len) != 0) {
 		free(addrs);
-		errno = ENOMEM;
 		return (-1);
 	}
 	*raddrs = &addrs->addr[0].sa;