More CreateProcess() fun.

Correctly handle the case where the application executable is under
a path which contains space and an executable sharing the initial
part of that path (up to a space) exists.

A (contrived) example is when Application is

  C:\stuff\app lications\foo.exe

and C:\stuff\app.exe also exists.

Thanks Eugene Lifshitz.
master
Iain Patterson 14 years ago
parent f1d0155706
commit 1766fb0329

@ -1,3 +1,11 @@
Changes since 2.9
-----------------
* Fixed edge case with CreateProcess().
Correctly handle the case where the application executable is under
a path which contains space and an executable sharing the initial
part of that path (up to a space) exists.
Changes since 2.8
-----------------
* Fixed failure to run on Windows versions prior to Vista.

@ -178,6 +178,7 @@ Thanks to Arve Knudsen for spotting that child processes of the monitored
application could be left running on service shutdown, and that a missing
registry value for AppDirectory confused NSSM.
Thanks to Peter Wagemans and Laszlo Keresztfalvi for suggesting throttling restarts.
Thanks to Eugene Lifshitz for finding an edge case in CreateProcess().
Licence
-------

@ -308,7 +308,7 @@ int start_service() {
/* Launch executable with arguments */
char cmd[CMD_LENGTH];
if (_snprintf(cmd, sizeof(cmd), "%s %s", exe, flags) < 0) {
if (_snprintf(cmd, sizeof(cmd), "\"%s\" %s", exe, flags) < 0) {
log_event(EVENTLOG_ERROR_TYPE, NSSM_EVENT_OUT_OF_MEMORY, "command line", "start_service", 0);
return stop_service(2, true, true);
}

Loading…
Cancel
Save