Browse Source

Fixed bug #26355 (flock() doesn't initialize the wouldblock argument)

PEAR_1_4DEV
Ilia Alshanetsky 22 years ago
parent
commit
c722ab91ee
  1. 8
      ext/standard/file.c

8
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;
}

Loading…
Cancel
Save