mirror of
https://github.com/netfun2000/lcd4linux.git
synced 2026-02-27 09:44:34 +08:00
[lcd4linux @ 2001-03-09 12:14:24 by reinelt]
minor cleanups git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@104 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
@@ -29,9 +29,10 @@ we have to use libsensors instead of parsing the proc files directly
|
||||
// accept data from external sources (fifo?)
|
||||
// Done 2000-03-08, look at %x -lt
|
||||
|
||||
2001-02-11 Carsten Nau <info@cnau.de>
|
||||
connect a LED to a spare pin of the parallel port and show if ISDN
|
||||
is online
|
||||
// 2001-02-11 Carsten Nau <info@cnau.de>
|
||||
// connect a LED to a spare pin of the parallel port and show if ISDN
|
||||
// is online
|
||||
// Done with GPO's -mr
|
||||
|
||||
// 2001-01-27 Axel Ehnert <axel@ehnert.net>
|
||||
// - display numer of emails in a mailbox
|
||||
@@ -42,5 +43,6 @@ is online
|
||||
rename some tokens: %o->%os, %v->%ov, %r->%or, %p->%op,
|
||||
will be done with the big config-rework
|
||||
|
||||
2001-03-05 Leo Tötsch <lt@toetsch.at>
|
||||
replace T_EXTENDED with a Flag similar to 'bar'
|
||||
// 2001-03-05 Leo Tötsch <lt@toetsch.at>
|
||||
// replace T_EXTENDED with a Flag similar to 'bar'
|
||||
// rejected, T_EXTENDED does a good job -mr
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: cfg.c,v 1.11 2001/03/08 15:25:38 ltoetsch Exp $
|
||||
/* $Id: cfg.c,v 1.12 2001/03/09 12:14:24 reinelt Exp $
|
||||
*
|
||||
* config file stuff
|
||||
*
|
||||
@@ -20,6 +20,10 @@
|
||||
*
|
||||
*
|
||||
* $Log: cfg.c,v $
|
||||
* Revision 1.12 2001/03/09 12:14:24 reinelt
|
||||
*
|
||||
* minor cleanups
|
||||
*
|
||||
* Revision 1.11 2001/03/08 15:25:38 ltoetsch
|
||||
* improved exec
|
||||
*
|
||||
@@ -228,34 +232,34 @@ static int check_cfg_file(char *file)
|
||||
* - file is not accessible by other
|
||||
*/
|
||||
|
||||
uid_t uid, gid;
|
||||
int res;
|
||||
struct stat stbuf;
|
||||
|
||||
uid_t uid, gid;
|
||||
int error;
|
||||
|
||||
uid = geteuid();
|
||||
gid = getegid();
|
||||
|
||||
res = stat(file, &stbuf);
|
||||
if (res == -1) {
|
||||
if (stat(file, &stbuf) == -1) {
|
||||
error ("stat(%s) failed: %s", file, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if (S_ISCHR(stbuf.st_mode) && strcmp(file, "/dev/null") == 0)
|
||||
return 0;
|
||||
|
||||
error=0;
|
||||
if (!S_ISREG(stbuf.st_mode)) {
|
||||
error ("stat(%s) is not a regular file", file);
|
||||
return -1;
|
||||
error ("security error: '%s' is not a regular file", file);
|
||||
error=-1;
|
||||
}
|
||||
if (stbuf.st_uid != uid || stbuf.st_gid != gid) {
|
||||
error ("stat(%s) owner and/or group don't match", file);
|
||||
return -1;
|
||||
error ("security error: owner and/or group of '%s' don't match", file);
|
||||
error=-1;
|
||||
}
|
||||
if (stbuf.st_mode & S_IRWXG || stbuf.st_mode & S_IRWXO) {
|
||||
error ("stat(%s) group or other have access", file);
|
||||
return -1;
|
||||
error ("security error: group or other have access to '%s'", file);
|
||||
error=-1;
|
||||
}
|
||||
return 0;
|
||||
return error;
|
||||
}
|
||||
|
||||
int cfg_read (char *file)
|
||||
@@ -265,7 +269,7 @@ int cfg_read (char *file)
|
||||
char *line, *p, *s;
|
||||
|
||||
if (check_cfg_file(file) == -1) {
|
||||
error("open(%s) is insecure, we give up", file);
|
||||
error("config file '%s' is insecure, aborting", file);
|
||||
exit(2);
|
||||
}
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@ Overload 2.0
|
||||
Battwarning 10
|
||||
|
||||
SetiDir /etc/setiathome
|
||||
Mailbox1 /var/spool/mail/michii
|
||||
Mailbox1 /var/spool/mail/michi
|
||||
|
||||
Sensor1 /proc/sys/dev/sensors/as99127f-i2c-0-2d/temp1
|
||||
Sensor1_min 30
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: system.c,v 1.20 2001/03/02 20:18:12 reinelt Exp $
|
||||
/* $Id: system.c,v 1.21 2001/03/09 12:14:24 reinelt Exp $
|
||||
*
|
||||
* system status retreivement
|
||||
*
|
||||
@@ -20,6 +20,10 @@
|
||||
*
|
||||
*
|
||||
* $Log: system.c,v $
|
||||
* Revision 1.21 2001/03/09 12:14:24 reinelt
|
||||
*
|
||||
* minor cleanups
|
||||
*
|
||||
* Revision 1.20 2001/03/02 20:18:12 reinelt
|
||||
*
|
||||
* allow compile on systems without net/if_ppp.h
|
||||
@@ -749,8 +753,11 @@ int Sensor (int index, double *val, double *min, double *max)
|
||||
|
||||
snprintf(buffer, 32, "Sensor%d_min", index);
|
||||
min_buf[index]=atof(cfg_get(buffer)?:"0");
|
||||
*min=min_buf[index];
|
||||
|
||||
snprintf(buffer, 32, "Sensor%d_max", index);
|
||||
max_buf[index]=atof(cfg_get(buffer)?:"100");
|
||||
*max=max_buf[index];
|
||||
|
||||
fd[index]=open(sensor[index], O_RDONLY);
|
||||
if (fd[index]==-1) {
|
||||
|
||||
Reference in New Issue
Block a user