Typos and formatting etc.
authorIain Patterson <me@iain.cx>
Fri, 15 Nov 2013 15:43:46 +0000 (15:43 +0000)
committerIain Patterson <me@iain.cx>
Fri, 15 Nov 2013 16:02:52 +0000 (16:02 +0000)
ChangeLog.txt
messages.mc
process.cpp
service.cpp

index 36a7ab3..1513a54 100644 (file)
@@ -1,7 +1,7 @@
 Changes since 2.16
 -----------------
   * NSSM can now redirect the service's I/O streams to any path
-         capable of being opened by CreateFile().
+    capable of being opened by CreateFile().
 
   * Allow building on Visual Studio Express.
 
index 8b6c984..6f6ae40 100644 (file)
@@ -990,7 +990,7 @@ n'
 .
 Language = Italian
 La chiave di registro %2, utilizzata per specificare il minimo numero di millisecondi che devono intercorrere prima che il servizio %1 sia considerato avviato correttamente, non è di tipo REG_DWORD.
-Verrà usato il tempo di default pari a 3 ms.
+Verrà usato il tempo di default pari a %3 ms.
 .
 
 MessageId = +1
index ee88af3..fc0056d 100644 (file)
@@ -41,7 +41,7 @@ int check_parent(char *service_name, PROCESSENTRY32 *pe, unsigned long ppid, FIL
   HANDLE process_handle = OpenProcess(PROCESS_QUERY_INFORMATION, false, pe->th32ProcessID);
   if (! process_handle) {
     char pid_string[16];
-    _snprintf_s(pid_string, sizeof(pid_string), _TRUNCATE, "%d", pe->th32ProcessID);
+    _snprintf_s(pid_string, sizeof(pid_string), _TRUNCATE, "%lu", pe->th32ProcessID);
     log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OPENPROCESS_FAILED, pid_string, service_name, error_string(GetLastError()), 0);
     return 2;
   }
@@ -243,8 +243,8 @@ void kill_process_tree(char *service_name, unsigned long stop_method, unsigned l
   if (! pid) return;
 
   char pid_string[16], code[16];
-  _snprintf_s(pid_string, sizeof(pid_string), _TRUNCATE, "%d", pid);
-  _snprintf_s(code, sizeof(code), _TRUNCATE, "%d", exitcode);
+  _snprintf_s(pid_string, sizeof(pid_string), _TRUNCATE, "%lu", pid);
+  _snprintf_s(code, sizeof(code), _TRUNCATE, "%lu", exitcode);
   log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_KILLING, service_name, pid_string, code, 0);
 
   /* Get a snapshot of all processes in the system. */
@@ -290,7 +290,7 @@ void kill_process_tree(char *service_name, unsigned long stop_method, unsigned l
   }
 
   char ppid_string[16];
-  _snprintf_s(ppid_string, sizeof(ppid_string), _TRUNCATE, "%d", ppid);
+  _snprintf_s(ppid_string, sizeof(ppid_string), _TRUNCATE, "%lu", ppid);
   log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_KILL_PROCESS_TREE, pid_string, ppid_string, service_name, 0);
   if (! kill_process(service_name, stop_method, process_handle, pid, exitcode)) {
     /* Maybe it already died. */
index d0cba9f..d8dd1aa 100644 (file)
@@ -280,7 +280,7 @@ int monitor_service() {
   }\r
   log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_STARTED_SERVICE, exe, flags, service_name, dir, 0);\r
 \r
-  /* Monitor service service */\r
+  /* Monitor service */\r
   if (! RegisterWaitForSingleObject(&wait_handle, process_handle, end_service, (void *) pid, INFINITE, WT_EXECUTEONLYONCE | WT_EXECUTELONGFUNCTION)) {\r
     log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_REGISTERWAITFORSINGLEOBJECT_FAILED, service_name, exe, error_string(GetLastError()), 0);\r
   }\r
@@ -309,11 +309,11 @@ void log_service_control(char *service_name, unsigned long control, bool handled
     /* "0x" + 8 x hex + NULL */\r
     text = (char *) HeapAlloc(GetProcessHeap(), 0, 11);\r
     if (! text) {\r
-      log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control", 0);\r
+      log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control()", 0);\r
       return;\r
     }\r
     if (_snprintf_s(text, 11, _TRUNCATE, "0x%08x", control) < 0) {\r
-      log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control", 0);\r
+      log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "control code", "log_service_control()", 0);\r
       HeapFree(GetProcessHeap(), 0, text);\r
       return;\r
     }\r
@@ -497,11 +497,12 @@ void CALLBACK end_service(void *arg, unsigned char why) {
     tree.  See below for the possible values of the why argument.\r
   */\r
   if (! why) {\r
-    _snprintf_s(code, sizeof(code), _TRUNCATE, "%d", exitcode);\r
+    _snprintf_s(code, sizeof(code), _TRUNCATE, "%lu", exitcode);\r
     log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_ENDED_SERVICE, exe, service_name, code, 0);\r
   }\r
 \r
   /* Clean up. */\r
+  if (exitcode == STILL_ACTIVE) exitcode = 0;\r
   kill_process_tree(service_name, stop_method, pid, exitcode, pid, &creation_time, &exit_time);\r
 \r
   /*\r
@@ -569,8 +570,8 @@ void throttle_restart() {
   if (throttle > 7) throttle = 8;\r
 \r
   char threshold[8], milliseconds[8];\r
-  _snprintf_s(threshold, sizeof(threshold), _TRUNCATE, "%d", throttle_delay);\r
-  _snprintf_s(milliseconds, sizeof(milliseconds), _TRUNCATE, "%d", ms);\r
+  _snprintf_s(threshold, sizeof(threshold), _TRUNCATE, "%lu", throttle_delay);\r
+  _snprintf_s(milliseconds, sizeof(milliseconds), _TRUNCATE, "%lu", ms);\r
   log_event(EVENTLOG_WARNING_TYPE, NSSM_EVENT_THROTTLED, service_name, threshold, milliseconds, 0);\r
 \r
   if (use_critical_section) EnterCriticalSection(&throttle_section);\r