aboutsummaryrefslogtreecommitdiffstats
path: root/cputemp.c
diff options
context:
space:
mode:
authorPA4WDH2024-08-25 16:57:08 +0200
committerPA4WDH2024-08-25 16:57:08 +0200
commitda347a996939a8fe7277d180d0098094332e63d7 (patch)
treedce4dfcca60fadf10ed464bbc1cde27fc8db0d6b /cputemp.c
parentSmall bugfix in sensor autodetection when -P is used (diff)
downloadcputemp2maxfreq-da347a996939a8fe7277d180d0098094332e63d7.tar.gz
cputemp2maxfreq-da347a996939a8fe7277d180d0098094332e63d7.tar.bz2
cputemp2maxfreq-da347a996939a8fe7277d180d0098094332e63d7.zip
Add -Wall -Werror and fix warnings
Diffstat (limited to 'cputemp.c')
-rw-r--r--cputemp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/cputemp.c b/cputemp.c
index e30cc31..ca616b1 100644
--- a/cputemp.c
+++ b/cputemp.c
@@ -79,7 +79,7 @@ void cputemp_read_hwmon(char *hwmon,char *sensor_name,struct s_sensor *sensor)
{
DIR *hwmon_dir;
struct dirent *hwmon_dirent;
- char name_file[255];
+ char name_file[258];
char input_file[255];
int offset;
@@ -100,10 +100,10 @@ void cputemp_read_hwmon(char *hwmon,char *sensor_name,struct s_sensor *sensor)
if (cputemp_is_label(hwmon_dirent->d_name))
{
DEBUG2_CPUTEMP("Found label %s\n",hwmon_dirent->d_name);
- sprintf(name_file,"%s/%s",hwmon,hwmon_dirent->d_name);
- sprintf(input_file,"%s/%s",hwmon,hwmon_dirent->d_name);
+ snprintf(name_file,258,"%s/%s",hwmon,hwmon_dirent->d_name);
+ snprintf(input_file,258,"%s/%s",hwmon,hwmon_dirent->d_name);
offset=strlen(input_file)-5;
- strncpy(input_file+offset,"input",5);
+ strncpy(input_file+offset,"input",6);
cputemp_match_and_validate(name_file,input_file,sensor_name,sensor);
}
hwmon_dirent=readdir(hwmon_dir);
@@ -126,7 +126,7 @@ void cputemp_find_sensor(char *sensor_name,struct s_sensor *sensor)
{
DIR *hwmon_dir;
struct dirent *hwmon_dirent;
- char subdir[255];
+ char subdir[273];
DEBUG1_CPUTEMP("Searching for sensor %s\n",sensor_name);
@@ -149,7 +149,7 @@ void cputemp_find_sensor(char *sensor_name,struct s_sensor *sensor)
// Note that /sys/class/hwmon actually contains symlinks but we treat them like directories
if (strncmp(hwmon_dirent->d_name,"hwmon",5)==0)
{
- sprintf(subdir,"/sys/class/hwmon/%s",hwmon_dirent->d_name);
+ snprintf(subdir,273,"/sys/class/hwmon/%s",hwmon_dirent->d_name);
DEBUG2_CPUTEMP("Found hwmon entry: %s\n",subdir);
cputemp_read_hwmon(subdir,sensor_name,sensor);
}