Changeset 4792

Show
Ignore:
Timestamp:
09/09/07 17:47:08 (6 years ago)
Author:
khali
Message:

Do not attempt to read label files from procfs, they do not exist
there.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/lib/access.c

    r4640 r4792  
    2828#include "proc.h" 
    2929#include "general.h" 
     30#include "sysfs.h" 
    3031 
    3132static int sensors_do_this_chip_sets(sensors_chip_name name); 
     
    150151        const sensors_chip *chip; 
    151152        const sensors_chip_feature *featureptr; 
    152         char buf[128], path[PATH_MAX]; 
    153         FILE *f; 
    154153        int i; 
    155154 
     
    167166                        } 
    168167 
    169         /* No user specified label, check for a _label sysfs file */ 
    170         snprintf(path, PATH_MAX, "%s/%s_label", name.busname, 
    171                 featureptr->data.name); 
    172          
    173         if ((f = fopen(path, "r"))) { 
    174                 i = fread(buf, 1, sizeof(buf) - 1, f); 
    175                 fclose(f); 
    176                 if (i > 0) { 
    177                         /* i - 1 to strip the '\n' at the end */ 
    178                         buf[i - 1] = 0; 
    179                         *result = strdup(buf); 
    180                         goto sensors_get_label_exit; 
     168        if (sensors_found_sysfs) { 
     169                char buf[128], path[PATH_MAX]; 
     170                FILE *f; 
     171 
     172                /* No user specified label, check for a _label sysfs file */ 
     173                snprintf(path, PATH_MAX, "%s/%s_label", name.busname, 
     174                        featureptr->data.name); 
     175 
     176                if ((f = fopen(path, "r"))) { 
     177                        i = fread(buf, 1, sizeof(buf) - 1, f); 
     178                        fclose(f); 
     179                        if (i > 0) { 
     180                                /* i - 1 to strip the '\n' at the end */ 
     181                                buf[i - 1] = 0; 
     182                                *result = strdup(buf); 
     183                                goto sensors_get_label_exit; 
     184                        } 
    181185                } 
    182186        }