diff options
author | George Peter Banyard <girgias@php.net> | 2020-09-23 23:46:58 +0100 |
---|---|---|
committer | George Peter Banyard <girgias@php.net> | 2020-10-10 14:45:20 +0100 |
commit | 150ebfdf77320b24b0358f8a903e90d7940ad4a4 (patch) | |
tree | 06e83f7b7f4fed49bdc08033d093aa94dad9ac8f /main/streams/xp_socket.c | |
parent | f211f1586f1e93acee49df852b999b9402d32f5d (diff) | |
download | php-git-150ebfdf77320b24b0358f8a903e90d7940ad4a4.tar.gz |
Suppress bogus [-Wlogical-op] warning from GCC
See GCC bug 69602: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
which emits the warning for (errno == EWOULDBLOCK || errno == EAGAIN)
which is the correct way of handling errors as the value of EWOULDBLOCK
and EAGAIN is implementation defined.
Therefore introduce a new macro function PHP_IS_TRANSIENT_ERROR()
which handles the case when EWOULDBLOCK and EAGAIN are identical.
Thanks to @twose for the idea.
Diffstat (limited to 'main/streams/xp_socket.c')
-rw-r--r-- | main/streams/xp_socket.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c index f3370e89f7..cd67fcb8ca 100644 --- a/main/streams/xp_socket.c +++ b/main/streams/xp_socket.c @@ -75,7 +75,8 @@ retry: if (didwrite <= 0) { char *estr; int err = php_socket_errno(); - if (err == EWOULDBLOCK || err == EAGAIN) { + + if (PHP_IS_TRANSIENT_ERROR(err)) { if (sock->is_blocked) { int retval; @@ -166,7 +167,7 @@ static ssize_t php_sockop_read(php_stream *stream, char *buf, size_t count) err = php_socket_errno(); if (nr_bytes < 0) { - if (err == EAGAIN || err == EWOULDBLOCK) { + if (PHP_IS_TRANSIENT_ERROR(err)) { nr_bytes = 0; } else { stream->eof = 1; |