diff --git a/src/switch.c b/src/switch.c index 985535cd8e..3966f5f9ee 100644 --- a/src/switch.c +++ b/src/switch.c @@ -96,14 +96,14 @@ static int freeswitch_kill_background() fprintf(stderr, "Killing: %d\n", (int) pid); #ifdef WIN32 snprintf(path, sizeof(path), "Global\\Freeswitch.%d", pid); - shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, path); - if (!shutdown_event) { - /* we can't get the event, so we can't signal the process to shutdown */ + shutdown_event = OpenEvent(EVENT_MODIFY_STATE, FALSE, path); + if (!shutdown_event) { + /* we can't get the event, so we can't signal the process to shutdown */ fprintf(stderr, "ERROR: Can't Shutdown: %d\n", (int) pid); - } else { - SetEvent(shutdown_event); - } - CloseHandle(shutdown_event); + } else { + SetEvent(shutdown_event); + } + CloseHandle(shutdown_event); #else kill(pid, SIGTERM); #endif