Skip to content

Commit beeeee2

Browse files
committed
Handle broken hrtime in ftp
Part of GH-19210. Closes GH-19219.
1 parent ad2143f commit beeeee2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

ext/ftp/ftp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1471,7 +1471,8 @@ static int my_poll(php_socket_t fd, int events, int timeout) {
14711471

14721472
if (n == -1 && php_socket_errno() == EINTR) {
14731473
zend_hrtime_t delta_ns = zend_hrtime() - start_ns;
1474-
if (delta_ns > timeout_hr) {
1474+
/* delta_ns == 0 is only possible with a platform that does not support a high-res timer. */
1475+
if (delta_ns > timeout_hr || UNEXPECTED(delta_ns == 0)) {
14751476
#ifndef PHP_WIN32
14761477
errno = ETIMEDOUT;
14771478
#endif

0 commit comments

Comments
 (0)