git://git.iain.cx/iain
/
nssm.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Safer set_environment().
[nssm.git]
/
service.cpp
diff --git
a/service.cpp
b/service.cpp
index
57dc7a2
..
09fbe1f
100644
(file)
--- a/
service.cpp
+++ b/
service.cpp
@@
-80,17
+80,17
@@
void cleanup_nssm_service(nssm_service_t *service) {
\r
/* About to install the service */
\r
int pre_install_service(int argc, TCHAR **argv) {
\r
\r
/* About to install the service */
\r
int pre_install_service(int argc, TCHAR **argv) {
\r
+ nssm_service_t *service = alloc_nssm_service();
\r
+ set_nssm_service_defaults(service);
\r
+ if (argc) _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);
\r
+
\r
/* Show the dialogue box if we didn't give the service name and path */
\r
/* Show the dialogue box if we didn't give the service name and path */
\r
- if (argc < 2) return nssm_gui(IDD_INSTALL,
argv[0]
);
\r
+ if (argc < 2) return nssm_gui(IDD_INSTALL,
service
);
\r
\r
\r
- nssm_service_t *service = alloc_nssm_service();
\r
if (! service) {
\r
print_message(stderr, NSSM_EVENT_OUT_OF_MEMORY, _T("service"), _T("pre_install_service()"));
\r
return 1;
\r
}
\r
if (! service) {
\r
print_message(stderr, NSSM_EVENT_OUT_OF_MEMORY, _T("service"), _T("pre_install_service()"));
\r
return 1;
\r
}
\r
-
\r
- set_nssm_service_defaults(service);
\r
- _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);
\r
_sntprintf_s(service->exe, _countof(service->exe), _TRUNCATE, _T("%s"), argv[1]);
\r
\r
/* Arguments are optional */
\r
_sntprintf_s(service->exe, _countof(service->exe), _TRUNCATE, _T("%s"), argv[1]);
\r
\r
/* Arguments are optional */
\r
@@
-122,11
+122,13
@@
int pre_install_service(int argc, TCHAR **argv) {
\r
/* About to remove the service */
\r
int pre_remove_service(int argc, TCHAR **argv) {
\r
\r
/* About to remove the service */
\r
int pre_remove_service(int argc, TCHAR **argv) {
\r
+ nssm_service_t *service = alloc_nssm_service();
\r
+ set_nssm_service_defaults(service);
\r
+ if (argc) _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);
\r
+
\r
/* Show dialogue box if we didn't pass service name and "confirm" */
\r
/* Show dialogue box if we didn't pass service name and "confirm" */
\r
- if (argc < 2) return nssm_gui(IDD_REMOVE,
argv[0]
);
\r
+ if (argc < 2) return nssm_gui(IDD_REMOVE,
service
);
\r
if (str_equiv(argv[1], _T("confirm"))) {
\r
if (str_equiv(argv[1], _T("confirm"))) {
\r
- nssm_service_t *service = alloc_nssm_service();
\r
- _sntprintf_s(service->name, _countof(service->name), _TRUNCATE, _T("%s"), argv[0]);
\r
int ret = remove_service(service);
\r
cleanup_nssm_service(service);
\r
return ret;
\r
int ret = remove_service(service);
\r
cleanup_nssm_service(service);
\r
return ret;
\r