[tor-commits] [tor/master] Fix testcases regarding O_NONBLOCK on parisc/hppa architecture

nickm at torproject.org nickm at torproject.org
Mon Feb 8 19:19:54 UTC 2021


commit 8ea00c85cb02df411d8df45aa5e71ac89b6c4e37
Author: Helge Deller <deller at gmx.de>
Date:   Tue Feb 2 12:03:13 2021 +0100

    Fix testcases regarding O_NONBLOCK on parisc/hppa architecture
    
    On the parisc/hppa architecture, the O_NONBLOCK constant can be either
    000200000 or 000200004, depending on the Linux kernel and glibc version
    on which the binary is running.
    Background of this can be read in this upstream Linux kernel patch:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=75ae04206a4d0e4f541c1d692b7febd1c0fdb814
    
    The tor testcases fail because of this, because function
    fd_is_nonblocking() checks hard against the O_NONBLOCK value, while it's
    sufficient if it would only check if one of the bits is set.
    
    Fix this trivial issue by just comparing if the returned file descriptor flag
    and'ed with O_NONBLOCK is non-zero.
    
    As reference, a failing build on parisc/hppa can be seen here:
    https://buildd.debian.org/status/fetch.php?pkg=tor&arch=hppa&ver=0.4.4.6-1%2Bb1&stamp=1612225628&raw=0
---
 src/test/test_util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/test/test_util.c b/src/test/test_util.c
index b3a1e2caca..c4da911f83 100644
--- a/src/test/test_util.c
+++ b/src/test/test_util.c
@@ -5937,7 +5937,7 @@ static int
 fd_is_nonblocking(tor_socket_t fd)
 {
   int flags = fcntl(fd, F_GETFL, 0);
-  return (flags & O_NONBLOCK) == O_NONBLOCK;
+  return (flags & O_NONBLOCK) != 0;
 }
 #endif /* !defined(_WIN32) */
 





More information about the tor-commits mailing list