opened the file before the path concatenates, what an idiot
This commit is contained in:
		@@ -564,12 +564,14 @@ wifi_perc(const char *wificard)
 | 
				
			|||||||
	char path[64];
 | 
						char path[64];
 | 
				
			||||||
	char status[5];
 | 
						char status[5];
 | 
				
			||||||
	char needle[strlen(wificard)+2];
 | 
						char needle[strlen(wificard)+2];
 | 
				
			||||||
	FILE *fp = fopen(path, "r");
 | 
						FILE *fp;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	strlcpy(path, "/sys/class/net/", sizeof(path));
 | 
						strlcpy(path, "/sys/class/net/", sizeof(path));
 | 
				
			||||||
	strlcat(path, wificard, sizeof(path));
 | 
						strlcat(path, wificard, sizeof(path));
 | 
				
			||||||
	strlcat(path, "/operstate", sizeof(path));
 | 
						strlcat(path, "/operstate", sizeof(path));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						fp = fopen(path, "r");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if(fp == NULL) {
 | 
						if(fp == NULL) {
 | 
				
			||||||
		fprintf(stderr, "Error opening wifi operstate file: %s\n",
 | 
							fprintf(stderr, "Error opening wifi operstate file: %s\n",
 | 
				
			||||||
							strerror(errno));
 | 
												strerror(errno));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user