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));
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,
FILE *fp = fopen("/proc/sys/kernel/random/entropy_avail", "r");
if (fp == NULL) {
- fprintf(stderr, "Could not open entropy file.\n");
+ fprintf(stderr, "Could not open entropy file: %s\n",
+ strerror(errno));
return smprintf(UNKNOWN_STR);
}
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));