1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-01-13 11:15:27 +00:00

two conky fixes

* opened file for laptop_mode wasn't closed again
* hopefully fix reading interface addresses


git-svn-id: https://conky.svn.sourceforge.net/svnroot/conky/trunk/conky1@1047 7f574dfc-610e-0410-a909-a81674777703
This commit is contained in:
Phil 2008-03-24 20:35:20 +00:00
parent 4ba940b550
commit 749fb99edd

View File

@ -178,6 +178,7 @@ int get_laptop_mode()
if ((fp = fopen("/proc/sys/vm/laptop_mode", "r")) != NULL)
fscanf(fp, "%d\n", &val);
fclose(fp);
return val;
}
@ -383,14 +384,17 @@ inline void update_net_stats()
i = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
conf.ifc_buf = malloc(sizeof(struct ifreq) * 16);
conf.ifc_len = sizeof(struct ifreq) * 16;
memset(conf.ifc_buf, 0, conf.ifc_len);
ioctl((long) i, SIOCGIFCONF, &conf);
for (k = 0; k < conf.ifc_len / sizeof(struct ifreq); k++) {
struct net_stat *ns;
if (!(((struct ifreq *) conf.ifc_buf) + k))
break;
ns = get_net_stat(
((struct ifreq *) conf.ifc_buf)[k].ifr_ifrn.ifrn_name);
ns->addr = ((struct ifreq *) conf.ifc_buf)[k].ifr_ifru.ifru_addr;