From: Sascha Schumann Date: Sun, 28 May 2000 16:22:28 +0000 (+0000) Subject: Use php_syslog() for system call. On OpenServer 5, syslog is defined to X-Git-Tag: PRE_EIGHT_BYTE_ALLOC_PATCH~213 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0d9c0616f9bf1441cddadc1ff1e9870d2e1c09e0;p=php Use php_syslog() for system call. On OpenServer 5, syslog is defined to var_syslog/sys_syslog which causes various problems. Submitted by: Paul Gardiner --- diff --git a/ext/standard/syslog.c b/ext/standard/syslog.c index bcc89be78c..464545367e 100644 --- a/ext/standard/syslog.c +++ b/ext/standard/syslog.c @@ -252,7 +252,7 @@ PHP_FUNCTION(syslog) * this will cause problems. */ - syslog((*priority)->value.lval, (*message)->value.str.val); + php_syslog((*priority)->value.lval, (*message)->value.str.val); RETURN_TRUE; } /* }}} */ diff --git a/main/main.c b/main/main.c index aacdc87196..416e1fb333 100644 --- a/main/main.c +++ b/main/main.c @@ -53,11 +53,9 @@ #ifdef PHP_WIN32 #include #include -#include "win32/syslog.h" #include "win32/php_registry.h" -#else -#include #endif +#include "php_syslog.h" #if PHP_SIGCHILD #include @@ -251,9 +249,9 @@ void php_log_err(char *log_message) /* Try to use the specified logging location. */ if (PG(error_log) != NULL) { -#if HAVE_SYSLOG_H +#ifdef HAVE_SYSLOG_H if (!strcmp(PG(error_log), "syslog")) { - syslog(LOG_NOTICE, log_message); + php_syslog(LOG_NOTICE, log_message); return; } #endif diff --git a/main/php_syslog.h b/main/php_syslog.h new file mode 100644 index 0000000000..f356ff5418 --- /dev/null +++ b/main/php_syslog.h @@ -0,0 +1,33 @@ +#ifndef PHP_SYSLOG_H +#define PHP_SYSLOG_H + +#ifdef PHP_WIN32 +#include "win32/syslog.h" +#include "win32/php_registry.h" +#else +#include +#endif + +/* + * SCO OpenServer 5 defines syslog to var_syslog/sys_syslog which + * causes trouble with our use of syslog. We define php_syslog + * to be the system function syslog. + */ + +#ifdef syslog + +#if defined(var_syslog) && var_syslog == syslog +#define php_syslog var_syslog +#elif defined(sys_syslog) && sys_syslog == syslog +#define php_syslog sys_syslog +#endif + +#endif + +#ifndef php_syslog +#define php_syslog syslog +#undef syslog +#endif + + +#endif