瀏覽代碼

Don't fail to restart if the service is stopped.

Treat a restart control on a stopped service as a start control.
Iain Patterson 12 年之前
父節點
當前提交
0f9817471a
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      service.cpp

+ 3 - 0
service.cpp

@@ -1214,6 +1214,9 @@ int control_service(unsigned long control, int argc, TCHAR **argv) {
     else {
       CloseHandle(service_handle);
       _ftprintf(stderr, _T("%s: %s: %s"), canonical_name, service_control_text(control), error_string(error));
+      if (error == ERROR_SERVICE_NOT_ACTIVE) {
+        if (control == SERVICE_CONTROL_SHUTDOWN || control == SERVICE_CONTROL_STOP) return 0;
+      }
       return 1;
     }
   }