diff options
author | Arnaud Le Blanc <lbarnaud@php.net> | 2008-11-26 04:19:20 +0000 |
---|---|---|
committer | Arnaud Le Blanc <lbarnaud@php.net> | 2008-11-26 04:19:20 +0000 |
commit | dffdb48c3bd3e5a5a35f3a041e5b328c558cd236 (patch) | |
tree | 379bfd2a1fa2db48da91d586c29b3f15cc03e66e /main | |
parent | c5c9fd8b07afb4ae9d13d804f9508923dffbee2e (diff) | |
download | php-git-dffdb48c3bd3e5a5a35f3a041e5b328c558cd236.tar.gz |
MFH: Fixed bug #46673 (stream_lock call with wrong paramater)
Diffstat (limited to 'main')
-rw-r--r-- | main/streams/userspace.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 327544c032..5d56cfb5a3 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -22,6 +22,10 @@ #include "php.h" #include "php_globals.h" #include "ext/standard/file.h" +#include "ext/standard/flock_compat.h" +#ifdef HAVE_SYS_FILE_H +#include <sys/file.h> +#endif static int le_protocols; @@ -942,7 +946,23 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value case PHP_STREAM_OPTION_LOCKING: MAKE_STD_ZVAL(zvalue); - ZVAL_LONG(zvalue, value); + ZVAL_LONG(zvalue, 0); + + if (value & LOCK_NB) { + Z_LVAL_P(zvalue) |= PHP_LOCK_NB; + } + switch(value & ~LOCK_NB) { + case LOCK_SH: + Z_LVAL_P(zvalue) |= PHP_LOCK_SH; + break; + case LOCK_EX: + Z_LVAL_P(zvalue) |= PHP_LOCK_EX; + break; + case LOCK_UN: + Z_LVAL_P(zvalue) |= PHP_LOCK_UN; + break; + } + args[0] = &zvalue; /* TODO wouldblock */ |