Source-Changes-HG archive

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

[src/trunk]: src/tests/net/icmp Handle ENOBUFS in sendto



details:   https://anonhg.NetBSD.org/src/rev/c73308f586d5
branches:  trunk
changeset: 321560:c73308f586d5
user:      roy <roy%NetBSD.org@localhost>
date:      Thu Mar 22 17:27:34 2018 +0000

description:
Handle ENOBUFS in sendto

diffstat:

 tests/net/icmp/t_ping.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (35 lines):

diff -r 9f4398de9ec9 -r c73308f586d5 tests/net/icmp/t_ping.c
--- a/tests/net/icmp/t_ping.c   Thu Mar 22 17:16:05 2018 +0000
+++ b/tests/net/icmp/t_ping.c   Thu Mar 22 17:27:34 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $  */
+/*     $NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $  */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: t_ping.c,v 1.18 2018/03/22 17:16:05 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -182,8 +182,14 @@
                icmp->icmp_seq = htons(loop);
                icmp->icmp_cksum = 0;
                icmp->icmp_cksum = in_cksum(icmp, pktsize);
-               RL(rump_sys_sendto(s, icmp, pktsize, 0,
-                   (struct sockaddr *)&dst, sizeof(dst)));
+
+               n = rump_sys_sendto(s, icmp, pktsize, 0,
+                   (struct sockaddr *)&dst, sizeof(dst));
+               if (n == -1) {
+                       if (errno == ENOBUFS)
+                               continue;
+                       atf_tc_fail_errno("sendto failed");
+               }
 
                RL(rump_sys_fcntl(s, F_SETFL, xnon));
                while ((n = rump_sys_recvfrom(s, recvbuf, sizeof(recvbuf), 0,



Home | Main Index | Thread Index | Old Index