forked from enlightenment/evisum
Fixe
This commit is contained in:
parent
655dacb953
commit
2c2930cc60
2
NEWS
2
NEWS
|
@ -22,7 +22,7 @@ Evisum 0.2.0
|
||||||
|
|
||||||
* Add command-line utility (tingle) to complement
|
* Add command-line utility (tingle) to complement
|
||||||
evisum.
|
evisum.
|
||||||
* Fix object destruction before exitting main loop.
|
* Fix object destruction before exiting main loop.
|
||||||
* Add variable unit display (K, M and G).
|
* Add variable unit display (K, M and G).
|
||||||
* Minor refactoring.
|
* Minor refactoring.
|
||||||
|
|
||||||
|
|
|
@ -109,7 +109,12 @@ Fcontents(const char *path)
|
||||||
char *buf;
|
char *buf;
|
||||||
char byte[1];
|
char byte[1];
|
||||||
size_t count, bytes = 0;
|
size_t count, bytes = 0;
|
||||||
FILE *f = fopen(path, "r");
|
struct stat st;
|
||||||
|
FILE *f;
|
||||||
|
|
||||||
|
if (stat(path, &st) < 0) return NULL;
|
||||||
|
|
||||||
|
f = fopen(path, "r");
|
||||||
if (!f) return NULL;
|
if (!f) return NULL;
|
||||||
|
|
||||||
int n = 1024;
|
int n = 1024;
|
||||||
|
@ -870,8 +875,8 @@ _battery_state_get(power_t *power, int *mib)
|
||||||
{
|
{
|
||||||
naming = NULL;
|
naming = NULL;
|
||||||
snprintf(path, sizeof(path), "/sys/class/power_supply/%s", power->battery_names[i]);
|
snprintf(path, sizeof(path), "/sys/class/power_supply/%s", power->battery_names[i]);
|
||||||
stat(path, &st);
|
|
||||||
|
|
||||||
|
if (stat(path, &st) < 0) continue;
|
||||||
if (S_ISLNK(st.st_mode)) continue;
|
if (S_ISLNK(st.st_mode)) continue;
|
||||||
if (!S_ISDIR(st.st_mode)) continue;
|
if (!S_ISDIR(st.st_mode)) continue;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue