From c722ab91eebfd14a099f87581f8ab27f5f91a39f Mon Sep 17 00:00:00 2001 From: Ilia Alshanetsky Date: Mon, 24 Nov 2003 01:42:43 +0000 Subject: [PATCH] Fixed bug #26355 (flock() doesn't initialize the wouldblock argument) --- ext/standard/file.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ext/standard/file.c b/ext/standard/file.c index ffebc2fb4b5..4b3ec87444d 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; }