Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys PR/51854: Ngie Cooper: sys/socket.h inclu...



details:   https://anonhg.NetBSD.org/src/rev/b02c10159a64
branches:  trunk
changeset: 820702:b02c10159a64
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 13 20:41:50 2017 +0000

description:
PR/51854: Ngie Cooper: sys/socket.h include and check result from socket(2)

diffstat:

 tests/lib/libc/sys/t_listen.c |  4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diffs (25 lines):

diff -r e4f5d3d31021 -r b02c10159a64 tests/lib/libc/sys/t_listen.c
--- a/tests/lib/libc/sys/t_listen.c     Fri Jan 13 20:31:53 2017 +0000
+++ b/tests/lib/libc/sys/t_listen.c     Fri Jan 13 20:41:50 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_listen.c,v 1.4 2012/03/18 07:00:52 jruoho Exp $      */
+/*     $NetBSD: t_listen.c,v 1.5 2017/01/13 20:41:50 christos Exp $    */
 /*
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -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,



Home | Main Index | Thread Index | Old Index