Skip to content

Commit 7ceae66

Browse files
committedJun 30, 2022
streams/xp_socket: fix clang build error with enum usage on bool condition.
Fix targeted for oses defining those flags as enums (like Linux/glibc). `error: converting the enum constant to a boolean [-Werror,-Wint-in-bool-context] } else if ((!sslsock->ssl_active && value == 0 && (MSG_DONTWAIT || !sslsock->s.is_blocked)) ||` Closes #8895.
1 parent b09420e commit 7ceae66

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed
 

‎ext/openssl/xp_ssl.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2399,7 +2399,7 @@ static int php_openssl_sockop_set_option(php_stream *stream, int option, int val
23992399

24002400
if (sslsock->s.socket == -1) {
24012401
alive = 0;
2402-
} else if ((!sslsock->ssl_active && value == 0 && (MSG_DONTWAIT || !sslsock->s.is_blocked)) ||
2402+
} else if ((!sslsock->ssl_active && value == 0 && ((MSG_DONTWAIT != 0) || !sslsock->s.is_blocked)) ||
24032403
php_pollfd_for(sslsock->s.socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
24042404
/* the poll() call was skipped if the socket is non-blocking (or MSG_DONTWAIT is available) and if the timeout is zero */
24052405
/* additionally, we don't use this optimization if SSL is active because in that case, we're not using MSG_DONTWAIT */

‎main/streams/xp_socket.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
337337

338338
if (sock->socket == -1) {
339339
alive = 0;
340-
} else if ((value == 0 && (MSG_DONTWAIT || !sock->is_blocked)) || php_pollfd_for(sock->socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
340+
} else if ((value == 0 && ((MSG_DONTWAIT != 0) || !sock->is_blocked)) || php_pollfd_for(sock->socket, PHP_POLLREADABLE|POLLPRI, &tv) > 0) {
341341
/* the poll() call was skipped if the socket is non-blocking (or MSG_DONTWAIT is available) and if the timeout is zero */
342342
#ifdef PHP_WIN32
343343
int ret;

0 commit comments

Comments
 (0)
Please sign in to comment.