(main,service_main) [_WIN32]: Remove printf for errors
during startup, as logerror will print to stderr or to log file. Remove logerror for successful installation and removal.
This commit is contained in:
parent
d1d7028fc7
commit
0ba025cb4b
2 changed files with 0 additions and 14 deletions
|
@ -72,7 +72,6 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
|
|||
|
||||
if (schSCManager == NULL) {
|
||||
logerror("install_service failed to open Service Control Manager");
|
||||
printf("Install service: failed to open Service Control Manager.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -94,7 +93,6 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
|
|||
|
||||
if (schService == NULL) {
|
||||
logerror("install_service failed to create service %s", service_name);
|
||||
printf("Install service: failed to create service %s.\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
sdBuf.lpDescription = "Server for Empire game";
|
||||
|
@ -104,10 +102,8 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
|
|||
SERVICE_CONFIG_DESCRIPTION, /* change: description */
|
||||
&sdBuf)) { /* value: new description */
|
||||
logerror("install_service failed to set the description");
|
||||
printf("Install service: failed to set the description.\n");
|
||||
}
|
||||
|
||||
logerror("install_service successfully created the service %s", service_name);
|
||||
printf("Service %s installed.\n", service_name);
|
||||
CloseServiceHandle(schService);
|
||||
return EXIT_SUCCESS;
|
||||
|
@ -128,7 +124,6 @@ remove_service(char *service_name)
|
|||
|
||||
if (schSCManager == NULL) {
|
||||
logerror("remove_service failed to open Service Control Manager");
|
||||
printf("remove service: failed to open Service Control Manager.\n");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -136,22 +131,18 @@ remove_service(char *service_name)
|
|||
|
||||
if (hService == NULL) {
|
||||
logerror("remove_service failed to open service %s", service_name);
|
||||
printf("Remove service: failed to open service %s.\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (DeleteService(hService) == 0) {
|
||||
logerror("remove_service failed to remove service %s", service_name);
|
||||
printf("Remove service: failed to remove service %s.\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
if (CloseServiceHandle(hService) == 0) {
|
||||
logerror("remove_service failed to close service %s", service_name);
|
||||
printf("Remove service: failed to close service %s.\n", service_name);
|
||||
return EXIT_FAILURE;
|
||||
} else {
|
||||
logerror("remove_service successfully removed service %s", service_name);
|
||||
printf("Service %s removed.\n", service_name);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -172,21 +172,16 @@ main(int argc, char **argv)
|
|||
remove_service_set) {
|
||||
logerror("Can't use -d, -D or -e with either "
|
||||
"-r or -R options when starting the server");
|
||||
printf("Can't use -d, -D or -e with either -r "
|
||||
"or -R options\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (debug && install_service_set) {
|
||||
logerror("Can't use -d with either "
|
||||
"-i or -I options when starting the server");
|
||||
printf("Can't use -d with either -i "
|
||||
"or -I options\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (install_service_set && remove_service_set) {
|
||||
logerror("Can't use both -r or -R and -i or -I options when starting "
|
||||
"the server");
|
||||
printf("Can't use both -r or -R and -i or -I options\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue