diff options
author | PA4WDH | 2023-05-21 10:38:18 +0200 |
---|---|---|
committer | PA4WDH | 2023-05-21 10:38:18 +0200 |
commit | 825454b9b04fbcd4676a06d65f6ee94fdcbc3a78 (patch) | |
tree | 88d277788a2373882fc656780e6bc4133c16c4cd | |
parent | Remove buildtime from version.h, add branch (diff) | |
download | cputemp2maxfreq-825454b9b04fbcd4676a06d65f6ee94fdcbc3a78.tar.gz cputemp2maxfreq-825454b9b04fbcd4676a06d65f6ee94fdcbc3a78.tar.bz2 cputemp2maxfreq-825454b9b04fbcd4676a06d65f6ee94fdcbc3a78.zip |
Make failsafe exit code variable
-rw-r--r-- | cputemp2maxfreq.c | 2 | ||||
-rw-r--r-- | failsafe.c | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/cputemp2maxfreq.c b/cputemp2maxfreq.c index ee983ca..163917c 100644 --- a/cputemp2maxfreq.c +++ b/cputemp2maxfreq.c @@ -54,7 +54,7 @@ int main() printf("Failed to set governor, error %d (%s).\n",errno,strerror(errno)); // We failed to set the governor, call the failsafe - failsafe(); + failsafe(1); } while(1) @@ -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); } |