bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] test-select: avoid warn_unused_result warnings


From: Bruno Haible
Subject: Re: [PATCH] test-select: avoid warn_unused_result warnings
Date: Sat, 25 Dec 2010 01:31:37 +0100
User-agent: KMail/1.9.9

Hi Jim,

You wrote on 2010-10-13 in
<http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00318.html>:
> * tests/test-select.c: Include "macros.h".
> ASSERT that each call to read, write, and pipe succeeds.
> While not technically required, also check each "close".

The last part causes a failure on OSF/1 5.1:

  Unconnected socket test... passed
  Connected sockets test... test-select.c:357: assertion failed
  sh: 366989 Abort - core dumped
  FAIL: test-select

The reason is that after one end of the connection has been closed,
the close() on the other end fails, signalling that some bytes have
been written have been lost.

This patch avoids the failure. Since you said that it's "not
technically required" to check each close(), I assume you agree.


2010-12-24  Bruno Haible  <address@hidden>

        select tests: Avoid failures on OSF/1 5.1.
        * tests/test-select.c (test_accept_first, test_socket_pair): Ignore
        failure of closing the last socket; it may fail with ECONNRESET.

--- tests/test-select.c.orig    Sat Dec 25 01:23:38 2010
+++ tests/test-select.c Sat Dec 25 01:22:32 2010
@@ -310,7 +310,7 @@
         failed ("cannot read data left in the socket by closed process");
       ASSERT (read (c, buf, 3) == 3);
       ASSERT (write (c, "foo", 3) == 3);
-      ASSERT (close (c) == 0);
+      (void) close (c); /* may fail with errno = ECONNRESET */
     }
 #endif
 }
@@ -354,7 +354,7 @@
   test_pair (c1, c2);
   ASSERT (close (c1) == 0);
   ASSERT (write (c2, "foo", 3) == 3);
-  ASSERT (close (c2) == 0);
+  (void) close (c2); /* may fail with errno = ECONNRESET */
 }
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]