Source-Changes-HG archive

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

[src/trunk]: src/tests/net/icmp Note value received. Harden another sendto fo...



details:   https://anonhg.NetBSD.org/src/rev/1647fa2a4642
branches:  trunk
changeset: 321575:1647fa2a4642
user:      roy <roy%NetBSD.org@localhost>
date:      Fri Mar 23 10:05:45 2018 +0000

description:
Note value received. Harden another sendto for ENOBUFS.

diffstat:

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

diffs (58 lines):

diff -r 5fb6033526ad -r 1647fa2a4642 tests/net/icmp/t_ping.c
--- a/tests/net/icmp/t_ping.c   Fri Mar 23 09:43:33 2018 +0000
+++ b/tests/net/icmp/t_ping.c   Fri Mar 23 10:05:45 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: t_ping.c,v 1.19 2018/03/22 17:27:34 roy Exp $  */
+/*     $NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 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.19 2018/03/22 17:27:34 roy Exp $");
+__RCSID("$NetBSD: t_ping.c,v 1.20 2018/03/23 10:05:45 roy Exp $");
 #endif /* not lint */
 
 #include <sys/types.h>
@@ -198,7 +198,7 @@
                }
                if (n == -1 && (errno == EAGAIN || errno == ENOBUFS))
                        continue;
-               atf_tc_fail_errno("recv failed");
+               atf_tc_fail_errno("recv failed (n == %d)", n);
        }
 
        rump_sys_close(s);
@@ -334,7 +334,7 @@
        char ifname[IFNAMSIZ];
        pid_t cpid;
        size_t tot, frag;
-       int s, x, loop;
+       int s, x, loop, error;
 
        cpid = fork();
        rump_init();
@@ -418,15 +418,18 @@
                                ip->ip_off |= IP_MF;
                        }
 
-                       RL(rump_sys_sendto(s, data, frag, 0,
-                           (struct sockaddr *)&dst, sizeof(dst)));
+                       error = rump_sys_sendto(s, data, frag, 0,
+                           (struct sockaddr *)&dst, sizeof(dst));
+                       if (error == -1 && errno == ENOBUFS)
+                               continue;
+                       atf_tc_fail_errno("sendto failed");
                }
                if (waitpid(-1, &status, WNOHANG) > 0) {
                        if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
                                break;
                        atf_tc_fail("child did not exit clean");
                }
-                       
+
                usleep(10000);
        }
 }



Home | Main Index | Thread Index | Old Index