[prev in list] [next in list] [prev in thread] [next in thread]
List: php-cvs
Subject: [PHP-CVS] [php-src] master: Close GH-8306: don't use of bitwise '|' with boolean operands
From: "Christoph M. Becker" <noreply () php ! net>
Date: 2022-04-28 12:46:45
Message-ID: LqftV0BZLmqLi4rcKFOBEtFfm9uYmCiMSMj21dCz9A () main ! php ! net
[Download RAW message or body]
Author: Christoph M. Becker (cmb69)
Date: 2022-04-28T14:42:36+02:00
Commit: https://github.com/php/php-src/commit/3c28be825593c154089f75ebc949394e0163f670
Raw diff: https://github.com/php/php-src/commit/3c28be825593c154089f75ebc949394e0163f670.diff
Close GH-8306: don't use of bitwise '|' with boolean operands
The code used bitwise operators to avoid the short-circuiting behavior
of the logical operators. We refactor for clarity, and to keep
compilers and static analyzers happy.
Closes GH-8442.
Changed paths:
M sapi/phpdbg/phpdbg.c
Diff:
diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
index de05a6fec60b..e39a5c7fb4e6 100644
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@ -864,7 +864,10 @@ static ssize_t phpdbg_stdiop_write(php_stream *stream, const \
char *buf, size_t c while (data->fd >= 0) {
struct stat stat[3];
memset(stat, 0, sizeof(stat));
- if (((fstat(fileno(stderr), &stat[2]) < 0) & (fstat(fileno(stdout), &stat[0]) < \
0)) | (fstat(data->fd, &stat[1]) < 0)) { + int stat_stderr = fstat(fileno(stderr), \
&stat[2]); + int stat_stdout = fstat(fileno(stdout), &stat[0]);
+ int stat_datafd = fstat(data->fd, &stat[1]);
+ if ((stat_stderr < 0 && stat_stdout < 0) || stat_datafd < 0) {
break;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic