Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Nov 2012 13:50:22 +0100
From:      Pawel Jakub Dawidek <pjd@FreeBSD.org>
To:        Michael Tuexen <tuexen@FreeBSD.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r242512 - head/lib/libc/net
Message-ID:  <20121104125021.GS1399@garage.freebsd.pl>
In-Reply-To: <201211031322.qA3DMQPg072355@svn.freebsd.org>
References:  <201211031322.qA3DMQPg072355@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On Sat, Nov 03, 2012 at 01:22:26PM +0000, Michael Tuexen wrote:
> Author: tuexen
> Date: Sat Nov  3 13:22:25 2012
> New Revision: 242512
> URL: http://svn.freebsd.org/changeset/base/242512
> 
> Log:
>   Fix errno in a couple of error cases.
>   
>   MFC after: 3 days
> 
> Modified:
>   head/lib/libc/net/sctp_sys_calls.c
> 
> Modified: head/lib/libc/net/sctp_sys_calls.c
> ==============================================================================
> --- head/lib/libc/net/sctp_sys_calls.c	Sat Nov  3 09:18:37 2012	(r242511)
> +++ head/lib/libc/net/sctp_sys_calls.c	Sat Nov  3 13:22:25 2012	(r242512)
> @@ -449,6 +449,7 @@ sctp_getpaddrs(int sd, sctp_assoc_t id, 
>  	opt_len = (socklen_t) ((size_t)asoc + sizeof(struct sctp_getaddresses));
>  	addrs = calloc(1, (size_t)opt_len);
>  	if (addrs == NULL) {
> +		errno = ENOMEM;
>  		return (-1);
>  	}
>  	addrs->sget_assoc_id = id;
> @@ -777,6 +778,7 @@ sctp_sendx(int sd, const void *msg, size
>  	}
>  	buf = malloc(len);
>  	if (buf == NULL) {
> +		errno = ENOMEM;
>  		return (-1);
>  	}
>  	aa = (int *)buf;
> @@ -1052,7 +1054,7 @@ sctp_sendv(int sd,
>  	    CMSG_SPACE(sizeof(struct sctp_authinfo)) +
>  	    (size_t)addrcnt * CMSG_SPACE(sizeof(struct in6_addr)));
>  	if (cmsgbuf == NULL) {
> -		errno = ENOBUFS;
> +		errno = ENOMEM;
>  		return (-1);
>  	}

Both calloc(3) and malloc(3) should set errno to ENOMEM for you, so
all those three are redundant.

-- 
Pawel Jakub Dawidek                       http://www.wheelsystems.com
FreeBSD committer                         http://www.FreeBSD.org
Am I Evil? Yes, I Am!                     http://tupytaj.pl

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)

iEYEARECAAYFAlCWZIwACgkQForvXbEpPzSJ+ACeKYY0NnH1FrVKW50/j7MWWaYJ
YisAoJS6rQ1ttw+0/rD2UhPrGIU6rIwG
=nf7n
-----END PGP SIGNATURE-----

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20121104125021.GS1399>