mirror of
https://github.com/php/php-src.git
synced 2026-03-28 10:12:18 +01:00
Fixed bug #31363 (broken non-blocking flock()).
# Patch by ian at snork dot net
This commit is contained in:
@@ -339,13 +339,13 @@ PHP_FUNCTION(flock)
|
||||
|
||||
/* flock_values contains all possible actions if (operation & 4) we won't block on the lock */
|
||||
act = flock_values[act - 1] | (operation & 4 ? LOCK_NB : 0);
|
||||
if (!php_stream_lock(stream, act)) {
|
||||
if (php_stream_lock(stream, act)) {
|
||||
if (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) {
|
||||
Z_LVAL_P(arg3) = 1;
|
||||
}
|
||||
RETURN_TRUE;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
RETURN_FALSE;
|
||||
RETURN_TRUE;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -578,7 +578,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!flock(fd, value) || (errno == EWOULDBLOCK && value & LOCK_NB)) {
|
||||
if (!flock(fd, value)) {
|
||||
data->lock_flag = value;
|
||||
return 0;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user