iliaa           Thu Oct  9 21:38:04 2003 EDT

  Modified files:              (Branch: PHP_4_3)
    /php-src/ext/standard       file.c 
    /php-src    NEWS 
  Log:
  Fixed bug #25814 (Make flock() return correct value when 3rd argument is
  used).
  
  # This bug is 4.3.X specific, no need to MFB into 5.X tree.
  
  
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.279.2.37 php-src/ext/standard/file.c:1.279.2.38
--- php-src/ext/standard/file.c:1.279.2.37      Mon Sep 29 10:04:16 2003
+++ php-src/ext/standard/file.c Thu Oct  9 21:38:01 2003
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.279.2.37 2003/09/29 14:04:16 stas Exp $ */
+/* $Id: file.c,v 1.279.2.38 2003/10/10 01:38:01 iliaa Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -226,7 +226,7 @@
 PHP_FUNCTION(flock)
 {
        zval **arg1, **arg2, **arg3;
-       int fd, act, ret, arg_count = ZEND_NUM_ARGS();
+       int fd, act, arg_count = ZEND_NUM_ARGS();
        php_stream *stream;
 
        if (arg_count < 2 || arg_count > 3 || zend_get_parameters_ex(arg_count, &arg1, 
&arg2, &arg3) == FAILURE) {
@@ -250,11 +250,12 @@
        /* flock_values contains all possible actions
           if (arg2 & 4) we won't block on the lock */
        act = flock_values[act - 1] | (Z_LVAL_PP(arg2) & 4 ? LOCK_NB : 0);
-       if ((ret=flock(fd, act)) == -1) {
-               RETURN_FALSE;
-       }
-       if(ret == -1 && errno == EWOULDBLOCK && arg_count == 3) {
-               ZVAL_LONG(*arg3, 1);
+       if (flock(fd, act)) {
+               if (errno == EWOULDBLOCK && arg_count == 3) {
+                       ZVAL_LONG(*arg3, 1);
+               } else {
+                       RETURN_FALSE;
+               }       
        }
        RETURN_TRUE;
 }
Index: php-src/NEWS
diff -u php-src/NEWS:1.1247.2.432 php-src/NEWS:1.1247.2.433
--- php-src/NEWS:1.1247.2.432   Wed Oct  8 22:59:02 2003
+++ php-src/NEWS        Thu Oct  9 21:38:02 2003
@@ -3,6 +3,8 @@
 ?? Oct 2003, Version 4.3.4RC2
 - Fixed multibyte regex engine to properly handle ".*" pattern under
   POSIX compatible mode. (K.Kosako <kosako at sofnec.co.jp>, Moriyoshi)
+- Fixed bug #25814 (Make flock() return correct value when 3rd argument is
+  used). (Ilia)
 - Fixed bug #25780 (ext/session: invalid "session.cookie_lifetime" makes 
   session_start() to crash in win32). (Jani)
 - Fixed bug #25770 (Segfault with PHP and bison 1.875). ([EMAIL PROTECTED], Marcus)

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to