git: 4749d55fb3f1 - stable/13 - libc sctp: improve error reporting of sctp_getladdrs()

From: Michael Tuexen <tuexen_at_FreeBSD.org>
Date: Fri, 10 Dec 2021 10:28:49 UTC
The branch stable/13 has been updated by tuexen:

URL: https://cgit.FreeBSD.org/src/commit/?id=4749d55fb3f1d6c2933486cbf1a19c33e2161f32

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

    libc sctp: improve error reporting of sctp_getladdrs()
    
    Do not hide errno from getsockopt() called internally.
    
    MFC after:      1 week
    
    (cherry picked from commit 6e9309bd3b04501b69593900a14e01114c7f2404)
---
 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;