diff options
author | Ilia Alshanetsky <iliaa@php.net> | 2005-04-06 13:57:30 +0000 |
---|---|---|
committer | Ilia Alshanetsky <iliaa@php.net> | 2005-04-06 13:57:30 +0000 |
commit | a7ae41bf899fb22cda4008322e0847def49abeac (patch) | |
tree | 12e15a7c7720530359ad5da37564afeef1268275 | |
parent | 997690b1325f8aeeb39eddb08ed53de17860a985 (diff) | |
download | php-git-a7ae41bf899fb22cda4008322e0847def49abeac.tar.gz |
Fixed bug #31363 (broken non-blocking flock()).
# Patch by ian at snork dot net
-rw-r--r-- | ext/standard/file.c | 6 | ||||
-rw-r--r-- | main/streams/plain_wrapper.c | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 5b98c050ad..7ffc1c33be 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -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; } /* }}} */ diff --git a/main/streams/plain_wrapper.c b/main/streams/plain_wrapper.c index baa4c95087..ad362cf45f 100644 --- a/main/streams/plain_wrapper.c +++ b/main/streams/plain_wrapper.c @@ -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 { |