NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51854: [PATCH] tests/lib/libc/sys/t_listen: add sys/socket.h include and check result from socket(2)
The following reply was made to PR bin/51854; it has been noted by GNATS.
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51854: [PATCH] tests/lib/libc/sys/t_listen: add sys/socket.h
include and check result from socket(2)
Date: Thu, 12 Jan 2017 22:27:18 -0800
--Apple-Mail=_E9D44E0F-46BF-4DAE-B94D-FFC2A4395FB3
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_E9D44E0F-46BF-4DAE-B94D-FFC2A4395FB3
Content-Disposition: attachment;
filename=t_listen-add-sys-socket-and-check-result-from-socket.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="t_listen-add-sys-socket-and-check-result-from-socket.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/sys/t_listen.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/sys/t_listen.c,v
retrieving revision 1.4
diff -u -r1.4 t_listen.c
--- lib/libc/sys/t_listen.c 18 Mar 2012 07:00:52 -0000 1.4
+++ lib/libc/sys/t_listen.c 13 Jan 2017 06:12:22 -0000
@@ -26,6 +26,7 @@
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#include <sys/socket.h>
#include <atf-c.h>
#include <err.h>
#include <errno.h>
@@ -106,6 +107,7 @@
int sd, val;
sd = socket(AF_INET, SOCK_STREAM, 0);
+ ATF_REQUIRE_MSG(sd != -1, "socket failed: %s", strerror(errno));
val = IP_PORTRANGE_LOW;
if (setsockopt(sd, IPPROTO_IP, IP_PORTRANGE, &val,
--Apple-Mail=_E9D44E0F-46BF-4DAE-B94D-FFC2A4395FB3--
Home |
Main Index |
Thread Index |
Old Index