diff options
author | Helge Deller <deller@gmx.de> | 2021-02-02 12:03:13 +0100 |
---|---|---|
committer | Helge Deller <deller@gmx.de> | 2021-02-02 12:20:13 +0100 |
commit | 8ea00c85cb02df411d8df45aa5e71ac89b6c4e37 (patch) | |
tree | 154443b6cea771bf8e7e2b83e5699a2c731da1e9 /src/test/test_util.c | |
parent | a81581e6be5bc524429ebe513941006d00766e38 (diff) | |
download | tor-8ea00c85cb02df411d8df45aa5e71ac89b6c4e37.tar.gz tor-8ea00c85cb02df411d8df45aa5e71ac89b6c4e37.zip |
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
Diffstat (limited to 'src/test/test_util.c')
-rw-r--r-- | src/test/test_util.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) */ |