]> Zhao Yanbai Git Server - minix.git/commitdiff
tests: another fix 89/3289/1
authorDavid van Moolenbroek <david@minix3.org>
Mon, 25 Jan 2016 18:03:59 +0000 (19:03 +0100)
committerDavid van Moolenbroek <david@minix3.org>
Mon, 25 Jan 2016 18:07:40 +0000 (19:07 +0100)
- test80: resolve race condition resulting from unintended send

Change-Id: Id029d679a3903de0f712a15d4756952dbc36070c

minix/tests/common-socket.c

index 9300fa52840ca853ee3b6225e6e4c191221fc7f6..7de4f39ff662eca35948b19569fc73298ea7b3b2 100644 (file)
@@ -1637,12 +1637,12 @@ test_nonblock(const struct socket_test_info *info)
                test_fail("recv() should have yielded EAGAIN");
 
        /* This may be an implementation aspect, or even plain wrong (?). */
-       if (send(client_sd, buf, sizeof(buf), 0) != -1) {
-               if (!info->ignore_send_waiting) {
+       if (!info->ignore_send_waiting) {
+               if (send(client_sd, buf, sizeof(buf), 0) != -1) {
                        test_fail("send() should have failed");
+               } else if (errno != EAGAIN) {
+                       test_fail("send() should have yielded EAGAIN");
                }
-       } else if (errno != EAGAIN) {
-               test_fail("send() should have yielded EAGAIN");
        }
 
        switch (fork()) {