I see no reason for this lock.  We are in append mode and doing a single
write now.  No need to lock.

-Rasmus

Ilia Alshanetsky wrote:
> iliaa         Sun Apr  1 19:29:42 2007 UTC
> 
>   Modified files:              (Branch: PHP_5_2)
>     /php-src  NEWS 
>     /php-src/main     main.c 
>   Log:
>   
>   Fixed bug #40897 (error_log file not locked)
>   
>   
> http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.618&r2=1.2027.2.547.2.619&diff_format=u
> Index: php-src/NEWS
> diff -u php-src/NEWS:1.2027.2.547.2.618 php-src/NEWS:1.2027.2.547.2.619
> --- php-src/NEWS:1.2027.2.547.2.618   Sun Apr  1 19:09:36 2007
> +++ php-src/NEWS      Sun Apr  1 19:29:42 2007
> @@ -41,6 +41,7 @@
>    exceeded). (trickie at gmail dot com, Ilia)
>  - Fixed bug #40915 (addcslashes unexpected behavior with binary input). 
> (Tony)
>  - Fixed bug #40899 (memory leak when nesting list()). (Dmitry)
> +- Fixed bug #40897 (error_log file not locked). (Ilia)
>  - Fixed bug #40883 (mysql_query() is allocating memory incorrectly). (Tony)
>  - Fixed bug #40872 (inconsistency in offsetSet, offsetExists treatment of 
>    string enclosed integers). (Marcus)
> http://cvs.php.net/viewvc.cgi/php-src/main/main.c?r1=1.640.2.23.2.31&r2=1.640.2.23.2.32&diff_format=u
> Index: php-src/main/main.c
> diff -u php-src/main/main.c:1.640.2.23.2.31 
> php-src/main/main.c:1.640.2.23.2.32
> --- php-src/main/main.c:1.640.2.23.2.31       Fri Mar  2 21:58:05 2007
> +++ php-src/main/main.c       Sun Apr  1 19:29:42 2007
> @@ -18,7 +18,7 @@
>     +----------------------------------------------------------------------+
>  */
>  
> -/* $Id: main.c,v 1.640.2.23.2.31 2007/03/02 21:58:05 stas Exp $ */
> +/* $Id: main.c,v 1.640.2.23.2.32 2007/04/01 19:29:42 iliaa Exp $ */
>  
>  /* {{{ includes
>   */
> @@ -59,6 +59,7 @@
>  #include "ext/standard/php_standard.h"
>  #include "php_variables.h"
>  #include "ext/standard/credits.h"
> +#include "ext/standard/flock_compat.h"
>  #ifdef PHP_WIN32
>  #include <io.h>
>  #include <fcntl.h>
> @@ -358,10 +359,9 @@
>               log_file = VCWD_FOPEN(PG(error_log), "ab");
>               if (log_file != NULL) {
>                       time(&error_time);
> -                     strftime(error_time_str, sizeof(error_time_str), 
> "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf)); 
> -                     fprintf(log_file, "[%s] ", error_time_str);
> -                     fprintf(log_file, "%s", log_message);
> -                     fprintf(log_file, "%s", PHP_EOL);
> +                     strftime(error_time_str, sizeof(error_time_str), 
> "%d-%b-%Y %H:%M:%S", php_localtime_r(&error_time, &tmbuf));
> +                     php_flock(fileno(log_file), 2);
> +                     fprintf(log_file, "[%s] %s%s", error_time_str, 
> log_message, PHP_EOL);
>                       fclose(log_file);
>                       return;
>               }
> 

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

Reply via email to