diff options
author | PA4WDH | 2023-05-21 11:01:50 +0200 |
---|---|---|
committer | PA4WDH | 2023-05-21 11:01:50 +0200 |
commit | da1b103a50732804bec48429523011322eb1acf5 (patch) | |
tree | 1f1c73a56393a2b151f7751fc603ab017a05de71 /cpufreq.c | |
parent | Add input validation (diff) | |
download | cputemp2maxfreq-da1b103a50732804bec48429523011322eb1acf5.tar.gz cputemp2maxfreq-da1b103a50732804bec48429523011322eb1acf5.tar.bz2 cputemp2maxfreq-da1b103a50732804bec48429523011322eb1acf5.zip |
Improve error handling
Diffstat (limited to 'cpufreq.c')
-rw-r--r-- | cpufreq.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -20,6 +20,7 @@ int cpufreq_set_str(char *parameter,char *value,int checkdelay) { int fd; char sysfs_file[128]; + int done=0; DEBUG1_CPUFREQ("Set %s to %s\n",parameter,value) @@ -66,11 +67,14 @@ int cpufreq_set_str(char *parameter,char *value,int checkdelay) DEBUG1_CPUFREQ("Failed to set %s\n",d->d_name); return -1; } + done++; } bpos+=d->d_reclen; } } close(fd); + + return done; } int cpufreq_set_long_int(char *parameter,long int value,int checkdelay) @@ -78,5 +82,5 @@ int cpufreq_set_long_int(char *parameter,long int value,int checkdelay) char buf[255]; snprintf(buf,255,"%ld",value); - cpufreq_set_str(parameter,buf,checkdelay); + return cpufreq_set_str(parameter,buf,checkdelay); } |