Changeset 5748

Show
Ignore:
Timestamp:
06/30/09 22:52:20 (5 years ago)
Author:
khali
Message:

sensors_get_label: Merge pathname and label buffers (patch from
George Spelvin).

The lifetimes of the path and label name buffers are
disjoint, so a single buffer can be used for both purposes.

Files:
1 modified

Legend:

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

    r5747 r5748  
    169169        char *label; 
    170170        const sensors_chip *chip; 
    171         char buf[128], path[PATH_MAX]; 
     171        char buf[PATH_MAX]; 
    172172        FILE *f; 
    173173        int i; 
     
    184184 
    185185        /* No user specified label, check for a _label sysfs file */ 
    186         snprintf(path, PATH_MAX, "%s/%s_label", name->path, feature->name); 
     186        snprintf(buf, PATH_MAX, "%s/%s_label", name->path, feature->name); 
    187187         
    188         if ((f = fopen(path, "r"))) { 
    189                 i = fread(buf, 1, sizeof(buf) - 1, f); 
     188        if ((f = fopen(buf, "r"))) { 
     189                i = fread(buf, 1, sizeof(buf), f); 
    190190                fclose(f); 
    191191                if (i > 0) {