From: Gurucharan Shetty Date: Mon, 14 Apr 2014 19:57:53 +0000 (-0700) Subject: daemon-windows: Rename service variables. X-Git-Tag: sliver-openvswitch-2.2.90-1~3^2~98 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=69b17834a47300d13e86c680f03800d107ab9b1e daemon-windows: Rename service variables. Sa far, we are using variable 'detach' to indicate whether the option "--service" has been set. We were using variable 'detached' to indicate that the daemon is being called from the Windows services manager. An upcoming commit introduces command line option "--detach" for daemons running on Windows. This will cause confusion with variable names. Therefore, rename the variables. Signed-off-by: Gurucharan Shetty Acked-by: Ben Pfaff --- diff --git a/lib/daemon-windows.c b/lib/daemon-windows.c index da0bd118a..a00278ebb 100644 --- a/lib/daemon-windows.c +++ b/lib/daemon-windows.c @@ -23,8 +23,8 @@ VLOG_DEFINE_THIS_MODULE(daemon); -static bool detach; /* Was --service specified? */ -static bool detached; /* Have we already detached? */ +static bool service_create; /* Was --service specified? */ +static bool service_started; /* Have we dispatched service to start? */ /* --service-monitor: Should the service be restarted if it dies * unexpectedly? */ @@ -77,10 +77,10 @@ service_start(int *argcp, char **argvp[]) {NULL, NULL} }; - /* 'detached' is 'false' when service_start() is called the first time. - * It is 'true', when it is called the second time by the Windows services - * manager. */ - if (detached) { + /* 'service_started' is 'false' when service_start() is called the first + * time. It is 'true', when it is called the second time by the Windows + * services manager. */ + if (service_started) { init_service_status(); wevent = CreateEvent(NULL, TRUE, FALSE, NULL); @@ -133,14 +133,14 @@ service_start(int *argcp, char **argvp[]) * options before the call-back from the service control manager. */ for (i = 0; i < argc; i ++) { if (!strcmp(argv[i], "--service")) { - detach = true; + service_create = true; } else if (!strcmp(argv[i], "--service-monitor")) { monitor = true; } } /* If '--service' is not a command line option, run in foreground. */ - if (!detach) { + if (!service_create) { return; } @@ -149,7 +149,7 @@ service_start(int *argcp, char **argvp[]) * script. */ check_service(); - detached = true; + service_started = true; /* StartServiceCtrlDispatcher blocks and returns after the service is * stopped. */ @@ -184,7 +184,7 @@ control_handler(DWORD request) bool should_service_stop(void) { - if (detached) { + if (service_started) { if (service_status.dwCurrentState != SERVICE_RUNNING) { return true; } else {