Skip to content

Commit 6ccbaa1

Browse files
committed
Merge branch 'PHP-7.4' into PHP-8.0
* PHP-7.4: php-fpm: fix Solaris port events.mechanism
2 parents 0c57ebb + 2558acb commit 6ccbaa1

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ PHP NEWS
99
(cmb)
1010
. Fixed bug #80972 (Memory exhaustion on invalid string offset). (girgias)
1111

12+
- FPM:
13+
. Fixed bug #65800 (Events port mechanism). (psumbera)
14+
1215
- FTP:
1316
. Fixed bug #80901 (Info leak in ftp extension). (cmb)
1417
. Fixed bug #79100 (Wrong FTP error messages). (cmb)

sapi/fpm/fpm/events/port.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ static int fpm_event_port_clean() /* {{{ */
112112
*/
113113
static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long int timeout) /* {{{ */
114114
{
115-
int ret, i, nget;
115+
int ret
116+
unsigned int i, nget;
116117
timespec_t t;
117118

118119
/* convert timeout into timespec_t */
@@ -121,13 +122,25 @@ static int fpm_event_port_wait(struct fpm_event_queue_s *queue, unsigned long in
121122

122123
/* wait for inconming event or timeout. We want at least one event or timeout */
123124
nget = 1;
125+
events[0].portev_user = (void *)-1; /* so we can double check that an event was returned */
126+
124127
ret = port_getn(pfd, events, nevents, &nget, &t);
125128
if (ret < 0) {
126129

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

0 commit comments

Comments
 (0)