diff options
author | Anatol Belski <ab@php.net> | 2015-03-11 19:07:46 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2015-03-11 21:46:41 +0100 |
commit | cf4c60b3720188a5577d8729d9041bfce75efac9 (patch) | |
tree | a2300379299461c21b3c818880a77cd297fbfd8d /win32/wsyslog.c | |
parent | d5f2b4b398f1307074b69f9e35fc6ed5f3a69b23 (diff) | |
download | php-git-cf4c60b3720188a5577d8729d9041bfce75efac9.tar.gz |
use proper value to check the log_source handle
Diffstat (limited to 'win32/wsyslog.c')
-rw-r--r-- | win32/wsyslog.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/win32/wsyslog.c b/win32/wsyslog.c index ff0293fd9d..8244fa12f7 100644 --- a/win32/wsyslog.c +++ b/win32/wsyslog.c @@ -61,9 +61,9 @@ void closelog(void) { - if (PW32G(log_source)) { + if (INVALID_HANDLE_VALUE != PW32G(log_source)) { DeregisterEventSource(PW32G(log_source)); - PW32G(log_source) = NULL; + PW32G(log_source) = INVALID_HANDLE_VALUE; } if (PW32G(log_header)) { efree(PW32G(log_header)); @@ -86,7 +86,7 @@ void syslog(int priority, const char *message, ...) DWORD evid; /* default event source */ - if (!PW32G(log_source)) + if (INVALID_HANDLE_VALUE == PW32G(log_source)) openlog("php", LOG_PID, LOG_SYSLOG); switch (priority) { /* translate UNIX type into NT type */ @@ -122,11 +122,7 @@ void syslog(int priority, const char *message, ...) void openlog(const char *ident, int logopt, int facility) { - if (PW32G(log_source)) { - closelog(); - } - - efree(PW32G(log_header)); + closelog(); PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION); spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid()); |