]> granicus.if.org Git - php/commitdiff
Use php_syslog() for system call. On OpenServer 5, syslog is defined to
authorSascha Schumann <sas@php.net>
Sun, 28 May 2000 16:22:28 +0000 (16:22 +0000)
committerSascha Schumann <sas@php.net>
Sun, 28 May 2000 16:22:28 +0000 (16:22 +0000)
var_syslog/sys_syslog which causes various problems.

Submitted by: Paul Gardiner <I.T.Manager@barleychalu.co.uk>

ext/standard/syslog.c
main/main.c
main/php_syslog.h [new file with mode: 0644]

index bcc89be78ce2f3cae40d90a32cf994a0e98722c6..464545367e0a780b5e9ed46bae581a57926d7b37 100644 (file)
@@ -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;
 }
 /* }}} */
index aacdc87196fc165b2855727d1b9c2d8941a3a32e..416e1fb333d8e09ba943ecd5e184bb62bb8eed8d 100644 (file)
 #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 (file)
index 0000000..f356ff5
--- /dev/null
@@ -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