Browse Source

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.
Iain Patterson 9 years ago
parent
commit
2294db794e
4 changed files with 7 additions and 7 deletions
  1. 2 2
      imports.cpp
  2. 3 3
      io.cpp
  3. 1 1
      registry.cpp
  4. 1 1
      service.cpp

+ 2 - 2
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;

+ 3 - 3
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);

+ 1 - 1
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;
       }
     }

+ 1 - 1
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;
   }