Formatting.
[nssm.git] / service.cpp
index fbbab20..a86d744 100644 (file)
@@ -1213,7 +1213,7 @@ int control_service(unsigned long control, int argc, TCHAR **argv) {
     }\r
     else {\r
       CloseHandle(service_handle);\r
-      _ftprintf(stderr, _T("%s: %s %s"), canonical_name, service_control_text(control), error_string(error));\r
+      _ftprintf(stderr, _T("%s: %s: %s"), canonical_name, service_control_text(control), error_string(error));\r
       return 1;\r
     }\r
   }\r
@@ -1456,7 +1456,8 @@ unsigned long WINAPI service_control_handler(unsigned long control, unsigned lon
         ZeroMemory(&service->throttle_duetime, sizeof(service->throttle_duetime));\r
         SetWaitableTimer(service->throttle_timer, &service->throttle_duetime, 0, 0, 0, 0);\r
       }\r
-      service->status.dwCurrentState = SERVICE_CONTINUE_PENDING;\r
+      /* We can't continue if the application is running! */\r
+      if (! service->process_handle) service->status.dwCurrentState = SERVICE_CONTINUE_PENDING;\r
       service->status.dwWaitHint = throttle_milliseconds(service->throttle) + NSSM_WAITHINT_MARGIN;\r
       log_event(EVENTLOG_INFORMATION_TYPE, NSSM_EVENT_RESET_THROTTLE, service->name, 0);\r
       SetServiceStatus(service->status_handle, &service->status);\r
@@ -1472,8 +1473,8 @@ unsigned long WINAPI service_control_handler(unsigned long control, unsigned lon
 \r
     case NSSM_SERVICE_CONTROL_ROTATE:\r
       log_service_control(service->name, control, true);\r
-      if (service->rotate_stdout_online) service->rotate_stdout_online = NSSM_ROTATE_ONLINE_ASAP;\r
-      if (service->rotate_stdout_online) service->rotate_stderr_online = NSSM_ROTATE_ONLINE_ASAP;\r
+      if (service->rotate_stdout_online == NSSM_ROTATE_ONLINE) service->rotate_stdout_online = NSSM_ROTATE_ONLINE_ASAP;\r
+      if (service->rotate_stderr_online == NSSM_ROTATE_ONLINE) service->rotate_stderr_online = NSSM_ROTATE_ONLINE_ASAP;\r
       return NO_ERROR;\r
   }\r
 \r
@@ -1538,7 +1539,7 @@ int start_service(nssm_service_t *service) {
 \r
   if (get_process_creation_time(service->process_handle, &service->creation_time)) ZeroMemory(&service->creation_time, sizeof(service->creation_time));\r
 \r
-  close_output_handles(&si, ! service->rotate_stdout_online, ! service->rotate_stderr_online);\r
+  close_output_handles(&si);\r
 \r
   if (service->affinity) {\r
     /*\r