[php-src] poll-cleanup: ftp: For single fd poll calls, use php_pollfd_for_ms

From: Date: Fri, 24 Jul 2026 06:04:40 +0000
Subject: [php-src] poll-cleanup: ftp: For single fd poll calls, use php_pollfd_for_ms
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140187@lists.php.net to get a copy of this message
Author: Calvin Buckley (NattyNarwhal) Date: 2026-07-24T01:57:46-03:00 Commit: https://github.com/php/php-src/commit/ba7ffc4f306ddbafb9fa76f4046ca01ff06a90f3 Raw diff: https://github.com/php/php-src/commit/ba7ffc4f306ddbafb9fa76f4046ca01ff06a90f3.diff ftp: For single fd poll calls, use php_pollfd_for_ms Changed paths: M ext/ftp/ftp.c Diff: diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 0035e8508da1..20a67950627b 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -308,14 +308,9 @@ bool ftp_login(ftpbuf_t *ftp, const char *user, const size_t user_len, const cha case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: { - php_pollfd p; - int i; + int i, events = (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : POLLOUT; - p.fd = ftp->fd; - p.events = (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : POLLOUT; - p.revents = 0; - - i = php_poll2(&p, 1, 300); + i = php_pollfd_for_ms(ftp->fd, events, 300); retry = i > 0; } @@ -1388,14 +1383,9 @@ static int single_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t size) { case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_CONNECT: { - php_pollfd p; - int i; - - p.fd = fd; - p.events = POLLOUT; - p.revents = 0; + int i, events = POLLOUT; - i = php_poll2(&p, 1, 300); + i = php_pollfd_for_ms(fd, events, 300); retry = i > 0; } @@ -1521,14 +1511,9 @@ static int my_recv(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_CONNECT: { - php_pollfd p; - int i; + int i, events = POLLIN|POLLPRI; - p.fd = fd; - p.events = POLLIN|POLLPRI; - p.revents = 0; - - i = php_poll2(&p, 1, 300); + i = php_pollfd_for_ms(fd, events, 300); retry = i > 0; } @@ -1825,14 +1810,9 @@ static databuf_t* data_accept(databuf_t *data, ftpbuf_t *ftp) case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: { - php_pollfd p; - int i; - - p.fd = data->fd; - p.events = (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : POLLOUT; - p.revents = 0; + int i, events = (err == SSL_ERROR_WANT_READ) ? (POLLIN|POLLPRI) : POLLOUT; - i = php_poll2(&p, 1, 300); + i = php_pollfd_for_ms(data->fd, events, 300); retry = i > 0; }

« previous php.cvs (#140187) next »