diff --git a/daemon/cpugovctl.c b/daemon/cpugovctl.c index bc65ee4..35750ef 100644 --- a/daemon/cpugovctl.c +++ b/daemon/cpugovctl.c @@ -79,7 +79,7 @@ int main(int argc, char *argv[]) /* Must be root to set the state */ if (geteuid() != 0) { - fprintf(stderr, "This program must be run as root\n"); + LOG_ERROR("This program must be run as root\n"); return EXIT_FAILURE; } diff --git a/daemon/main.c b/daemon/main.c index 4fb8284..71b4a9e 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -113,12 +113,12 @@ int main(int argc, char *argv[]) break; case 's': { if ((status = gamemode_query_status()) < 0) { - fprintf(stderr, "gamemode status request failed: %s\n", gamemode_error_string()); + LOG_ERROR("gamemode status request failed: %s\n", gamemode_error_string()); exit(EXIT_FAILURE); } else if (status > 0) { - fprintf(stdout, "gamemode is active\n"); + LOG_MSG("gamemode is active\n"); } else { - fprintf(stdout, "gamemode is inactive\n"); + LOG_MSG("gamemode is inactive\n"); } exit(EXIT_SUCCESS); @@ -126,18 +126,17 @@ int main(int argc, char *argv[]) } case 'r': if (gamemode_request_start() < 0) { - fprintf(stderr, "gamemode request failed: %s\n", gamemode_error_string()); + LOG_ERROR("gamemode request failed: %s\n", gamemode_error_string()); exit(EXIT_FAILURE); } if ((status = gamemode_query_status()) == 2) { - fprintf(stdout, "gamemode request succeeded and is active\n"); + LOG_MSG("gamemode request succeeded and is active\n"); } else if (status == 1) { - fprintf(stderr, - "gamemode request succeeded and is active but registration failed\n"); + LOG_ERROR("gamemode request succeeded and is active but registration failed\n"); exit(EXIT_FAILURE); } else { - fprintf(stderr, "gamemode request succeeded but is not active\n"); + LOG_ERROR("gamemode request succeeded but is not active\n"); exit(EXIT_FAILURE); } @@ -149,7 +148,7 @@ int main(int argc, char *argv[]) // Explicitly clean up if (gamemode_request_end() < 0) { - fprintf(stderr, "gamemode request failed: %s\n", gamemode_error_string()); + LOG_ERROR("gamemode request failed: %s\n", gamemode_error_string()); exit(EXIT_FAILURE); } @@ -157,22 +156,22 @@ int main(int argc, char *argv[]) break; case 't': if ((status = game_mode_run_client_tests()) == 0) { - fprintf(stdout, "gamemode tests succeeded\n"); + LOG_MSG("gamemode tests succeeded\n"); exit(EXIT_SUCCESS); } else if (status == -1) { - fprintf(stderr, "gamemode tests failed\n"); + LOG_ERROR("gamemode tests failed\n"); exit(EXIT_FAILURE); } else { - fprintf(stderr, "gamemode test results unknown: %d\n", status); + LOG_ERROR("gamemode test results unknown: %d\n", status); exit(EXIT_FAILURE); } break; case 'v': - fprintf(stdout, VERSION_TEXT); + LOG_MSG(VERSION_TEXT); exit(EXIT_SUCCESS); break; case 'h': - fprintf(stdout, USAGE_TEXT, argv[0]); + LOG_MSG(USAGE_TEXT, argv[0]); exit(EXIT_SUCCESS); break; default: