mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
use proper value to check the log_source handle
This commit is contained in:
parent
d5f2b4b398
commit
cf4c60b372
2 changed files with 6 additions and 8 deletions
|
@ -34,6 +34,8 @@ void php_win32_core_globals_ctor(void *vg)
|
|||
memset(wg, 0, sizeof(*wg));
|
||||
|
||||
wg->mail_socket = INVALID_SOCKET;
|
||||
|
||||
wg->log_source = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
void php_win32_core_globals_dtor(void *vg)
|
||||
|
|
|
@ -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));
|
||||
|
||||
PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
|
||||
spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue