cvs: php4 / main.c php_syslog.h /ext/standard/ syslog.c

[email protected] ("Sascha Schumann")
Newsgroups php.version4
Message-ID <cvssas959530948@cvsserver>
sas		Sun May 28 09:22:28 2000 EDT

  Added files:
    /php4	php_syslog.h 

  Modified files:
    /php4	main.c 
    /php4/ext/standard	syslog.c 
  Log:
  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 <[email protected]>
  
  
Index: php4/main.c
diff -u php4/main.c:1.253 php4/main.c:1.254
--- php4/main.c:1.253	Sun May 28 05:30:06 2000
+++ php4/main.c	Sun May 28 09:22:28 2000
@@ -19,7 +19,7 @@
 */
 
 
-/* $Id: main.c,v 1.253 2000/05/28 12:30:06 thies Exp $ */
+/* $Id: main.c,v 1.254 2000/05/28 16:22:28 sas Exp $ */
 
 
 #include <stdio.h>
@@ -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 @@
 
 	/* 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
Index: php4/ext/standard/syslog.c
diff -u php4/ext/standard/syslog.c:1.20 php4/ext/standard/syslog.c:1.21
--- php4/ext/standard/syslog.c:1.20	Sun May 28 09:19:45 2000
+++ php4/ext/standard/syslog.c	Sun May 28 09:22:28 2000
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: syslog.c,v 1.20 2000/05/28 16:19:45 sas Exp $ */
+/* $Id: syslog.c,v 1.21 2000/05/28 16:22:28 sas Exp $ */
 
 #include "php.h"
 #include "php_ini.h"
@@ -252,7 +252,7 @@
 	 * this will cause problems.
 	 */
 
-	syslog((*priority)->value.lval, (*message)->value.str.val);
+	php_syslog((*priority)->value.lval, (*message)->value.str.val);
 	RETURN_TRUE;
 }
 /* }}} */

Index: php4/php_syslog.h
+++ php4/php_syslog.h
#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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.