Fixed missing NULLs in log_event().
authorIain Patterson <me@iain.cx>
Sat, 21 Dec 2013 12:30:33 +0000 (12:30 +0000)
committerIain Patterson <me@iain.cx>
Sat, 21 Dec 2013 13:44:43 +0000 (13:44 +0000)
The last argument to log_event must be NULL or messages with too many
parameters may not be logged.

imports.cpp
io.cpp
registry.cpp
service.cpp

index 68a5c7b..947b885 100644 (file)
@@ -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 (file)
--- a/io.cpp
+++ b/io.cpp
@@ -73,7 +73,7 @@ HANDLE append_to_file(TCHAR *path, unsigned long sharing, SECURITY_ATTRIBUTES *a
 \r
   unsigned long error = GetLastError();\r
   if (error != ERROR_FILE_NOT_FOUND) {\r
-    log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(error));\r
+    log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(error), 0);\r
     return (HANDLE) 0;\r
   }\r
 \r
@@ -196,7 +196,7 @@ int get_output_handles(nssm_service_t *service, HKEY key, STARTUPINFO *si) {
     if (str_equiv(path, stdout_path)) {\r
       /* Two handles to the same file will create a race. */\r
       if (! DuplicateHandle(GetCurrentProcess(), si->hStdOutput, GetCurrentProcess(), &si->hStdError, 0, true, DUPLICATE_SAME_ACCESS)) {\r
-        log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_DUPLICATEHANDLE_FAILED, NSSM_REG_STDOUT, error_string(GetLastError()));\r
+        log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_DUPLICATEHANDLE_FAILED, NSSM_REG_STDOUT, error_string(GetLastError()), 0);\r
         return 7;\r
       }\r
     }\r
@@ -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);\r
       si->hStdError = append_to_file(path, sharing, &attributes, disposition, flags);\r
       if (! si->hStdError) {\r
-        log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(GetLastError()));\r
+        log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_CREATEFILE_FAILED, path, error_string(GetLastError()), 0);\r
         return 8;\r
       }\r
       SetEndOfFile(si->hStdError);\r
index 048c07d..75d48c7 100644 (file)
@@ -385,7 +385,7 @@ int get_parameters(nssm_service_t *service, STARTUPINFO *si) {
         envlen = _tcslen(env) + 1;\r
         for (s = env; *s && *s != _T('='); s++);\r
         if (*s == _T('=')) *s++ = _T('\0');\r
-        if (! SetEnvironmentVariable(env, s)) log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_SETENVIRONMENTVARIABLE_FAILED, env, s, error_string(GetLastError()));\r
+        if (! SetEnvironmentVariable(env, s)) log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_SETENVIRONMENTVARIABLE_FAILED, env, s, error_string(GetLastError()), 0);\r
         env += envlen;\r
       }\r
     }\r
index 30a75d3..94cca76 100644 (file)
@@ -506,7 +506,7 @@ int stop_service(nssm_service_t *service, unsigned long exitcode, bool graceful,
   }\r
 \r
   if (default_action && ! exitcode && ! graceful) {\r
-    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);\r
+    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);\r
     graceful = true;\r
   }\r
 \r