From: Iain Patterson Date: Sat, 21 Dec 2013 12:30:33 +0000 (+0000) Subject: Fixed missing NULLs in log_event(). X-Git-Tag: v2.22~127 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=2294db794e6dfd5698fe57d135cd0da67aca95b0;p=nssm.git Fixed missing NULLs in log_event(). The last argument to log_event must be NULL or messages with too many parameters may not be logged. --- diff --git a/imports.cpp b/imports.cpp index 68a5c7b..947b885 100644 --- a/imports.cpp +++ b/imports.cpp @@ -15,7 +15,7 @@ HMODULE get_dll(const TCHAR *dll, unsigned long *error) { HMODULE ret = LoadLibrary(dll); if (! ret) { *error = GetLastError(); - log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_LOADLIBRARY_FAILED, dll, error_string(*error)); + log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_LOADLIBRARY_FAILED, dll, error_string(*error), 0); } return ret; @@ -27,7 +27,7 @@ FARPROC get_import(HMODULE library, const char *function, unsigned long *error) FARPROC ret = GetProcAddress(library, function); if (! ret) { *error = GetLastError(); - log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_GETPROCADDRESS_FAILED, function, error_string(*error)); + log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_GETPROCADDRESS_FAILED, function, error_string(*error), 0); } return ret; diff --git a/io.cpp b/io.cpp index 30deb72..4757e73 100644 --- a/io.cpp +++ b/io.cpp @@ -73,7 +73,7 @@ HANDLE append_to_file(TCHAR *path, unsigned long sharing, SECURITY_ATTRIBUTES *a unsigned long error = GetLastError(); if (error != ERROR_FILE_NOT_FOUND) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(error)); + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(error), 0); return (HANDLE) 0; } @@ -196,7 +196,7 @@ int get_output_handles(nssm_service_t *service, HKEY key, STARTUPINFO *si) { if (str_equiv(path, stdout_path)) { /* Two handles to the same file will create a race. */ if (! DuplicateHandle(GetCurrentProcess(), si->hStdOutput, GetCurrentProcess(), &si->hStdError, 0, true, DUPLICATE_SAME_ACCESS)) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_DUPLICATEHANDLE_FAILED, NSSM_REG_STDOUT, error_string(GetLastError())); + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_DUPLICATEHANDLE_FAILED, NSSM_REG_STDOUT, error_string(GetLastError()), 0); return 7; } } @@ -204,7 +204,7 @@ int get_output_handles(nssm_service_t *service, HKEY key, STARTUPINFO *si) { if (service->rotate_files) rotate_file(service->name, path, service->rotate_seconds, service->rotate_bytes_low, service->rotate_bytes_high); si->hStdError = append_to_file(path, sharing, &attributes, disposition, flags); if (! si->hStdError) { - log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(GetLastError())); + log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(GetLastError()), 0); return 8; } SetEndOfFile(si->hStdError); diff --git a/registry.cpp b/registry.cpp index 048c07d..75d48c7 100644 --- a/registry.cpp +++ b/registry.cpp @@ -385,7 +385,7 @@ int get_parameters(nssm_service_t *service, STARTUPINFO *si) { envlen = _tcslen(env) + 1; for (s = env; *s && *s != _T('='); s++); if (*s == _T('=')) *s++ = _T('\0'); - if (! SetEnvironmentVariable(env, s)) log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_SETENVIRONMENTVARIABLE_FAILED, env, s, error_string(GetLastError())); + if (! SetEnvironmentVariable(env, s)) log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_SETENVIRONMENTVARIABLE_FAILED, env, s, error_string(GetLastError()), 0); env += envlen; } } diff --git a/service.cpp b/service.cpp index 30a75d3..94cca76 100644 --- a/service.cpp +++ b/service.cpp @@ -506,7 +506,7 @@ int stop_service(nssm_service_t *service, unsigned long exitcode, bool graceful, } if (default_action && ! exitcode && ! graceful) { - log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service->name, service->exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY] ,0); + log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_GRACEFUL_SUICIDE, service->name, service->exe, exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_UNCLEAN], exit_action_strings[NSSM_EXIT_REALLY], 0); graceful = true; }