summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ext/standard/syslog.c2
-rw-r--r--main/main.c8
-rw-r--r--main/php_syslog.h33
3 files changed, 37 insertions, 6 deletions
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 <io.h>
#include <fcntl.h>
-#include "win32/syslog.h"
#include "win32/php_registry.h"
-#else
-#include <syslog.h>
#endif
+#include "php_syslog.h"
#if PHP_SIGCHILD
#include <sys/types.h>
@@ -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 <syslog.h>
+#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