diff options
author | Ali H. Fardan <raiz@firemail.cc> | 2016-08-31 06:00:14 +0300 |
---|---|---|
committer | Ali H. Fardan <raiz@firemail.cc> | 2016-08-31 06:00:14 +0300 |
commit | cd3c084957483c4192edf2e8feb4c759668a1055 (patch) | |
tree | 18176253509e7549e22e845d4ea19a9b8707546a /slstatus.c | |
parent | b800eb21a31921066bb0e574227b6b42d9223162 (diff) |
slow down boy! you opened the file too early!
Diffstat (limited to 'slstatus.c')
-rw-r--r-- | slstatus.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -105,7 +105,7 @@ battery_perc(const char *battery) int now, full, perc; char batterynowfile[64]; char batteryfullfile[64]; - FILE *fp = fopen(batterynowfile, "r"); + FILE *fp; strlcpy(batterynowfile, BATTERY_PATH, sizeof(batterynowfile)); strlcat(batterynowfile, battery, sizeof(batterynowfile)); @@ -117,6 +117,7 @@ battery_perc(const char *battery) strlcat(batteryfullfile, "/", sizeof(batteryfullfile)); strlcat(batteryfullfile, BATTERY_FULL, sizeof(batteryfullfile)); + fp = fopen(batterynowfile, "r"); if (fp == NULL ) { fprintf(stderr, "Error opening battery file: %s: %s\n", batterynowfile, |