summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli H. Fardan <raiz@firemail.cc>2016-08-31 14:29:27 +0300
committerAli H. Fardan <raiz@firemail.cc>2016-08-31 14:29:27 +0300
commitaa70b6633016ed35f9fa3d91c26751e973ac5d63 (patch)
treeb499f9636f8d4961a402b63f6e3f374def55a0e0
parent5e4dc85bb9bf821d87bcf8a13e0f0843fd68bfe1 (diff)
opened the file before the path concatenates, what an idiot
-rw-r--r--slstatus.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/slstatus.c b/slstatus.c
index f070e1d..a9aeecb 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -564,12 +564,14 @@ wifi_perc(const char *wificard)
char path[64];
char status[5];
char needle[strlen(wificard)+2];
- FILE *fp = fopen(path, "r");
+ FILE *fp;
strlcpy(path, "/sys/class/net/", sizeof(path));
strlcat(path, wificard, sizeof(path));
strlcat(path, "/operstate", sizeof(path));
+ fp = fopen(path, "r");
+
if(fp == NULL) {
fprintf(stderr, "Error opening wifi operstate file: %s\n",
strerror(errno));