From 825454b9b04fbcd4676a06d65f6ee94fdcbc3a78 Mon Sep 17 00:00:00 2001 From: PA4WDH Date: Sun, 21 May 2023 10:38:18 +0200 Subject: Make failsafe exit code variable --- failsafe.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'failsafe.c') diff --git a/failsafe.c b/failsafe.c index 5b3e7d3..3b9fe48 100644 --- a/failsafe.c +++ b/failsafe.c @@ -8,7 +8,7 @@ extern struct s_cpudata cpudata; extern struct s_config config; -void failsafe() +void failsafe(int code) { printf("Failed to set governor, error %d (%s).\n",errno,strerror(errno)); @@ -17,17 +17,17 @@ void failsafe() if (cpufreq_set_long_int("scaling_max_freq",cpudata.min_freq,100)==0) { printf("Set scaling frequency to CPU's minimum frequency."); - exit(1); + exit(code); } printf("Failed to set scaling frequency to CPU's minimum frequency, error: %d (%s).\n",errno,strerror(errno)); if (cpufreq_set_long_int("scaling_max_freq",config.fallback_freq,100)==0) { printf("Set scaling frequency to fallback frequency."); - exit(1); + exit(code); } printf("Failed to set scaling frequency to fallback frequency, error: %d (%s).\n",errno,strerror(errno)); printf("All safety measures failed, watch out not to fry your hardware.\n"); - exit(1); + exit(code); } -- cgit v1.2.3