@@ -48,7 +48,7 @@ int sysfs_count = 0;
4848int safe_snprintf (char * buffer , size_t buffer_size , const char * path1 , const char * path2 ) {
4949 size_t needed_size = strlen (path1 ) + strlen (path2 ) + 2 ; /* 1 for '/', 1 for '\0' */
5050 if (needed_size > buffer_size ) {
51- fprintf ( stderr , "Path too long: %s/%s\n" , path1 , path2 );
51+ AIM_LOG_ERROR ( "Path too long: %s/%s\n" , path1 , path2 );
5252 return -1 ;
5353 }
5454 snprintf (buffer , buffer_size , "%s/%s" , path1 , path2 );
@@ -116,11 +116,11 @@ static onlp_thermal_info_t linfo[] = {
116116
117117int initialize_regex () {
118118 if (regcomp (& dir_regex , "^hwmon[0-9]+$" , REG_EXTENDED ) != 0 ) {
119- fprintf ( stderr , "Failed to compile directory regex\n" );
119+ AIM_LOG_ERROR ( "Failed to compile directory regex\n" );
120120 return -1 ;
121121 }
122122 if (regcomp (& file_regex , "^temp([0-9]+)_input$" , REG_EXTENDED ) != 0 ) {
123- fprintf ( stderr , "Failed to compile file regex\n" );
123+ AIM_LOG_ERROR ( "Failed to compile file regex\n" );
124124 regfree (& dir_regex );
125125 return -1 ;
126126 }
@@ -136,7 +136,7 @@ void cleanup_regex() {
136136void scan_hwmon_files (const char * parent_path ) {
137137 DIR * parent_dir = opendir (parent_path );
138138 if (!parent_dir ) {
139- perror ("Failed to open parent directory" );
139+ AIM_LOG_ERROR ("Failed to open parent directory" );
140140 return ;
141141 }
142142
@@ -155,7 +155,7 @@ void scan_hwmon_files(const char *parent_path) {
155155
156156 DIR * subdir = opendir (subdir_path );
157157 if (!subdir ) {
158- perror ("Failed to open subdirectory" );
158+ AIM_LOG_ERROR ("Failed to open subdirectory" );
159159 continue ;
160160 }
161161
@@ -164,7 +164,7 @@ void scan_hwmon_files(const char *parent_path) {
164164 regmatch_t pmatch [2 ];
165165 if (regexec (& file_regex , sub_entry -> d_name , 2 , pmatch , 0 ) == 0 ) {
166166 if (count >= MAX_ENTRIES ) {
167- fprintf ( stderr , "Maximum entries reached. Ignoring additional files.\n" );
167+ AIM_LOG_ERROR ( "Maximum entries reached. Ignoring additional files.\n" );
168168 break ;
169169 }
170170
@@ -229,7 +229,6 @@ onlp_thermali_info_get(onlp_oid_t id, onlp_thermal_info_t* info)
229229 /* Set the onlp_oid_hdr_t and capabilities */
230230 * info = linfo [tid ];
231231 if (tid == THERMAL_CPU_CORE ) {
232-
233232 for (size_t i = 0 ; i < sysfs_count ; i ++ ) {
234233 if (onlp_file_read_int (& coretemp_temp , temp_entries [i ].name ) < 0 ) {
235234 AIM_LOG_ERROR ("Unable to read status from file (%s)\r\n" , temp_entries [i ].name );
0 commit comments