This checkin includes a few changes, but the only real problem that I saw was here:
- debug("Deleting the service '%s'.");
+ debug("Deleting the service '%s'.", serviceName);
Which was causing the process to core on uninstall. So I went through the other debug messages, and made a few more changes that most likely wouldn't have caused problems. For instance,
- debug("doStartApplication: spawn failed. Sent command:");
- debug(command);
+ debug("doStartApplication: spawn failed. Sent command: '%s'", command);
Technically, command could include a format directive (e.g. %s) in which case we'd have the same problem as debug("Deleting the service '%s'."), but this is unlikely. There are also a few other debug messages that I added to track down the real problem, and I've left them in.
| | |
| | | { |
| | | |
| | | returnValue = SERVICE_RETURN_ERROR; |
| | | debug("doStartApplication: spawn failed. Sent command:"); |
| | | debug(command); |
| | | debug("doStartApplication: spawn failed. Sent command: '%s'", command); |
| | | } |
| | | } |
| | | else |
| | |
| | | else |
| | | { |
| | | returnValue = SERVICE_RETURN_ERROR; |
| | | debug("doStopApplication: spawn failed. Sent command:"); |
| | | debug(command); |
| | | debug("doStopApplication: spawn failed. Sent command: %s", command); |
| | | } |
| | | } |
| | | else |
| | |
| | | // open the service |
| | | if (returnValue == SERVICE_RETURN_OK) |
| | | { |
| | | debug("About to open service '%s'.", serviceName); |
| | | myService = OpenService( |
| | | scm, |
| | | serviceName, |
| | | SERVICE_ALL_ACCESS | DELETE |
| | | ); |
| | | debug("After opening service myService=%d.", myService); |
| | | if (myService == NULL) |
| | | { |
| | | debugError("Failed to open the service '%s'. Last error = %d", serviceName, GetLastError()); |
| | |
| | | |
| | | if (returnValue == SERVICE_RETURN_OK) |
| | | { |
| | | BOOL success = QueryServiceStatus( |
| | | BOOL success; |
| | | debug("About to query the service '%s'.", serviceName); |
| | | success = QueryServiceStatus( |
| | | myService, |
| | | &serviceStatus |
| | | ); |
| | |
| | | // stop the service if necessary |
| | | if (returnValue == SERVICE_RETURN_OK) |
| | | { |
| | | debug("Successfully queried the service '%s'.", serviceName); |
| | | if (serviceStatus.dwCurrentState != SERVICE_STOPPED) |
| | | { |
| | | BOOL success; |
| | |
| | | if (returnValue == SERVICE_RETURN_OK) |
| | | { |
| | | BOOL success; |
| | | debug("Deleting the service '%s'."); |
| | | debug("Deleting the service '%s'.", serviceName); |
| | | success = DeleteService (myService); |
| | | if (!success) |
| | | { |
| | |
| | | |
| | | if ((strlen(relativePath) + strlen(instanceDir)) < maxSize) |
| | | { |
| | | sprintf(pidFile, maxSize, "%s\\logs\\server.pid", instanceDir); |
| | | sprintf(pidFile, "%s\\logs\\server.pid", instanceDir); |
| | | returnValue = TRUE; |
| | | debug("PID file name is '%s'.", pidFile); |
| | | } |
| | |
| | | else |
| | | { |
| | | char * msg = "Unknown subcommand: [%s]\n"; |
| | | debugError(msg, argc - 1); |
| | | debugError(msg, subcommand); |
| | | fprintf(stderr, msg, subcommand); |
| | | returnCode = -1; |
| | | } |