summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-11-24 01:42:43 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-11-24 01:42:43 +0000
commitc722ab91eebfd14a099f87581f8ab27f5f91a39f (patch)
tree7d76b280f8f62f7fe924ecafe23d80f166d0d9d1
parent0c5c01ad9d7521f9b322e60a5e5c24f01e91eebf (diff)
downloadphp-git-c722ab91eebfd14a099f87581f8ab27f5f91a39f.tar.gz
Fixed bug #26355 (flock() doesn't initialize the wouldblock argument)
-rw-r--r--ext/standard/file.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index ffebc2fb4b..4b3ec87444 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -263,12 +263,16 @@ PHP_FUNCTION(flock)
RETURN_FALSE;
}
+ if (arg3 && PZVAL_IS_REF(arg3)) {
+ convert_to_long_ex(&arg3);
+ Z_LVAL_P(arg3) = 0;
+ }
+
/* 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 (operation && errno == EWOULDBLOCK && arg3 && PZVAL_IS_REF(arg3)) {
- convert_to_long_ex(&arg3);
- ZVAL_LONG(arg3, 1);
+ Z_LVAL_P(arg3) = 1;
}
RETURN_TRUE;
}