[PATCH 4/6] Read extra configuration files from /etc/sensors.d

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 11 Feb 2009, Jean Delvare wrote:
> Read extra configuration files from /etc/sensors.d.

[...]
> +static int add_config_from_dir(const char *dir)
[...]
> +	for (res = 0, i = 0; !res && i < count; i++) {
> +		int len;
> +		char path[16 + NAME_MAX];
> +		FILE *input;
> +
> +		len = snprintf(path, sizeof(path), "%s/%s", dir,
> +			       namelist[i]->d_name);
> +		if (len < 0 || len >= (int)sizeof(path)) {
> +			res = -SENSORS_ERR_PARSE;
> +			continue;
> +		}

This says that the maximum length of the path to the config files is 16
characters?  Seems kind of short.  By default this will be
"/etc/sensors.d/" which clocks in at 15 bytes.  If somebody wants to use
(say) "/usr/local/etc/sensors.d/" they'll be out of luck.  Maybe
something like

char path[PATH_MAX + NAME_MAX];

would be better?

> +++ lm-sensors/lib/sensors.conf.5	2009-02-11 10:30:22.000000000 +0100
[...]
> +A directory where you can put additional libsensors configuration files.
> +Files found in this directory will be processed in alphabetical order after
> +the default configuration file. Files those name starts with a dot are
                                           ^
Spelling: "Files whose name starts"

> +++ lm-sensors/lib/libsensors.3	2009-02-11 10:29:09.000000000 +0100
[...]
> +A directory where you can put additional libsensors configuration files.
> +Files found in this directory will be processed in alphabetical order after
> +the default configuration file. Files those name starts with a dot are
                                           ^
Spelling: "Files whose name starts"

Matt Roberds




[Index of Archives]     [Linux Kernel]     [Linux Hardware Monitoring]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux