ID: 25814 User updated by: mike at aqua-helix dot com Reported By: mike at aqua-helix dot com Status: Open Bug Type: Filesystem function related Operating System: Linux RedHat 7.3 PHP Version: 4.3.4RC1 New Comment:
>From documentation about 'flock': The optional third argument is set to TRUE if the lock would block (EWOULDBLOCK errno condition) Actualy third argument will never set to true due to error in implementation. Let see the code (line 253 in 'file.c'): if ((ret=flock(fd, act)) == -1) { RETURN_FALSE; } if(ret == -1 && errno == EWOULDBLOCK && arg_count == 3) { ZVAL_LONG(*arg3, 1); } The second 'if' will never act as if ret==-1 function immediately returns false in the first 'if' Here is my version: if ((ret=flock(fd, act)) == -1) { if( errno == EWOULDBLOCK && arg_count == 3) ZVAL_LONG(arg3, 1); RETURN_FALSE; } Previous Comments: ------------------------------------------------------------------------ [2003-10-09 19:13:47] mike at aqua-helix dot com Description: ------------ >From documentation about 'flock': The optional third argument is set to TRUE if the lock would block (EWOULDBLOCK errno condition) Actualy third argument will never set to true due to error in implementation. Let see the code (line 253 in 'file.c'): if ((ret=flock(fd, act)) == -1) { RETURN_FALSE; } if(ret == -1 && errno == EWOULDBLOCK && arg_count == 3) { ZVAL_LONG(*arg3, 1); } The second 'if' will never act as if ret==1 function immediately returns false in the first 'if' Here is my version: if ((ret=flock(fd, act)) == -1) { if( errno == EWOULDBLOCK && arg_count == 3) ZVAL_LONG(arg3, 1); RETURN_FALSE; } ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=25814&edit=1