(main,service_main) [_WIN32]: Change startup errors to stderr from

logerror() as log file is not open yet.
This commit is contained in:
Ron Koenderink 2005-03-10 18:00:40 +00:00
parent f03de3f9a5
commit 98f3d6efca
2 changed files with 13 additions and 13 deletions

View file

@ -70,7 +70,7 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
schSCManager = OpenSCManager(NULL,NULL,SC_MANAGER_ALL_ACCESS);
if (schSCManager == NULL) {
logerror("install_service failed to open Service Control Manager");
fprintf(stderr, "install_service failed to open Service Control Manager\n");
return EXIT_FAILURE;
}
@ -91,7 +91,7 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
NULL); /* no password */
if (schService == NULL) {
logerror("install_service failed to create service %s", service_name);
fprintf(stderr, "install_service failed to create service %s\n", service_name);
return EXIT_FAILURE;
}
sdBuf.lpDescription = "Server for Empire game";
@ -100,7 +100,7 @@ install_service(char *program_name, char *service_name, int datadir_set, char *c
schService, /* handle to service */
SERVICE_CONFIG_DESCRIPTION, /* change: description */
&sdBuf)) { /* value: new description */
logerror("install_service failed to set the description");
fprintf(stderr, "install_service failed to set the description\n");
}
printf("Service %s installed.\n", service_name);
@ -122,24 +122,24 @@ remove_service(char *service_name)
schSCManager = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
if (schSCManager == NULL) {
logerror("remove_service failed to open Service Control Manager");
fprintf(stderr, "remove_service failed to open Service Control Manager\n");
return EXIT_FAILURE;
}
hService = OpenService(schSCManager, service_name, SERVICE_ALL_ACCESS);
if (hService == NULL) {
logerror("remove_service failed to open service %s", service_name);
fprintf(stderr, "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);
fprintf(stderr, "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);
fprintf(stderr, "remove_service failed to close service %s\n", service_name);
return EXIT_FAILURE;
} else {
printf("Service %s removed.\n", service_name);

View file

@ -169,18 +169,18 @@ main(int argc, char **argv)
#if defined(_WIN32)
if ((debug || datadir_set || config_file != NULL) &&
remove_service_set) {
logerror("Can't use -d, -D or -e with either "
"-r or -R options when starting the server");
fprintf(stderr, "Can't use -d, -D or -e with either "
"-r or -R options when starting the server\n");
exit(EXIT_FAILURE);
}
if (debug && install_service_set) {
logerror("Can't use -d with either "
"-i or -I options when starting the server");
fprintf(stderr, "Can't use -d with either "
"-i or -I options when starting the server\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");
fprintf(stderr, "Can't use both -r or -R and -i or -I options when starting "
"the server\n");
exit(EXIT_FAILURE);
}
#endif /* _WIN32 */