Date: 12/14/99
- Next message: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] oops."
- In reply to: Joey: "[PHP-DEV] Proposed change to main.c"
- Next in thread: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Reply: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, 14 Dec 1999, Joey wrote:
> void php3_log_err(char *log_message)
> {
> +
> + int date_len = (strlen(log_message)+1) + 32;
> + char date[date_len];
> + int mesg_len;
> +
Which compiler are you using? Declaring variables like this is bound to
cause compatibility problems. emalloc() your storage instead.
> FILE *log_file;
> +
> PLS_FETCH();
> #if APACHE
> SLS_FETCH();
> #endif
>
> + /* Add date and time to error mesage */
> + php_error_time(date, date_len);
> + mesg_len = (strlen(log_message)+strlen(date));
> +
> + if ( strlcat(date, log_message, (mesg_len+1)) <= mesg_len )
> + {
> + log_message = date;
> + }
> +
3rd argument to strlcat() should be amount of free space left, not how
many characters to copy.
> /* Try to use the specified logging location. */
> if (PG(error_log) != NULL) {
> #if HAVE_SYSLOG_H
> ***************
> *** 335,340 ****
> --- 350,367 ----
> #endif
> }
>
> + php_error_time(char *buf, int len)
> + {
> + time_t cur_time;
> + int retlen;
> +
> +
> + /* I'm not sure /WHAT/ to do if call to time fails? */
> + time(&cur_time);
> +
> + retlen = strftime( buf, len, "[%a %b %d %H:%M:%S %Y] ", localtime(&cur_time));
> +
> + }
Have you tested all this?
You might just want to send me the corrected patch and I'll add it after
review along with the .ini option that controls this behavior.
-Andrei
* Ethernet n.: something used to catch the etherbunny. *
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe <email protected> For additional commands, e-mail: php-dev-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Previous message: Andrei Zmievski: "Re: [PHP-DEV] oops."
- In reply to: Joey: "[PHP-DEV] Proposed change to main.c"
- Next in thread: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Reply: Joey: "Re: [PHP-DEV] Proposed change to main.c"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

