Skip to content

Commit

Permalink
Fixed bug #65800 php-fpm: fix Solaris port events.mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
krakjoe committed May 11, 2021
2 parents 57918b1 + 04078a5 commit 2558acb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS
Expand Up @@ -11,6 +11,9 @@ PHP NEWS
(cmb)
. Fixed bug #80972 (Memory exhaustion on invalid string offset). (girgias)

- FPM:
. Fixed bug #65800 (Events port mechanism). (psumbera)

- FTP:
. Fixed bug #80901 (Info leak in ftp extension). (cmb)
. Fixed bug #79100 (Wrong FTP error messages). (cmb)
Expand Down
15 changes: 14 additions & 1 deletion sapi/fpm/fpm/events/port.c
Expand Up @@ -114,7 +114,8 @@ static int fpm_event_port_clean() /* {{{ */
*/
static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long int timeout) /* {{{ */
{
int ret, i, nget;
int ret
unsigned int i, nget;
timespec_t t;

/* convert timeout into timespec_t */
Expand All @@ -123,13 +124,25 @@ static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long in

/* wait for inconming event or timeout. We want at least one event or timeout */
nget = 1;
events[0].portev_user = (void *)-1; /* so we can double check that an event was returned */

ret = port_getn(pfd, events, nevents, &nget, &t);
if (ret < 0) {

/* trigger error unless signal interrupt or timeout */
if (errno != EINTR && errno != ETIME) {
zlog(ZLOG_WARNING, "poll() returns %d", errno);
return -1;
} else if (nget > 0 && events[0].portev_user == (void *)-1) {
/* This confusing API can return an event at the same time
* that it reports EINTR or ETIME. If that occurs, just
* report the event. With EINTR, nget can be > 0 without
* any event, so check that portev_user was filled in.
*
* See discussion thread
* http://marc.info/?l=opensolaris-networking-discuss&m=125071205204540
*/
nget = 0;
}
}

Expand Down

0 comments on commit 2558acb

Please sign in to comment.