Commit f205f700 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Use regular readdir since readdir_r is deprecated and newer GCC complains.

parent e940aecf
...@@ -41,11 +41,9 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short ...@@ -41,11 +41,9 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
unsigned int nBatteries = 0; unsigned int nBatteries = 0;
memset(batteries, 0, MAX_BATTERIES * sizeof(char*)); memset(batteries, 0, MAX_BATTERIES * sizeof(char*));
struct dirent result;
struct dirent* dirEntry;
while (nBatteries < MAX_BATTERIES) { while (nBatteries < MAX_BATTERIES) {
int err = readdir_r(batteryDir, &result, &dirEntry); struct dirent* dirEntry = readdir(batteryDir);
if (err || !dirEntry) if (!dirEntry)
break; break;
char* entryName = dirEntry->d_name; char* entryName = dirEntry->d_name;
if (strncmp(entryName, "BAT", 3)) if (strncmp(entryName, "BAT", 3))
...@@ -97,11 +95,9 @@ static ACPresence procAcpiCheck() { ...@@ -97,11 +95,9 @@ static ACPresence procAcpiCheck() {
return AC_ERROR; return AC_ERROR;
} }
struct dirent result;
struct dirent* dirEntry;
for (;;) { for (;;) {
int err = readdir_r((DIR *) dir, &result, &dirEntry); struct dirent* dirEntry = readdir((DIR *) dir);
if (err || !dirEntry) if (!dirEntry)
break; break;
char* entryName = (char *) dirEntry->d_name; char* entryName = (char *) dirEntry->d_name;
...@@ -191,11 +187,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) { ...@@ -191,11 +187,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
unsigned long int totalFull = 0; unsigned long int totalFull = 0;
unsigned long int totalRemain = 0; unsigned long int totalRemain = 0;
struct dirent result;
struct dirent* dirEntry;
for (;;) { for (;;) {
int err = readdir_r((DIR *) dir, &result, &dirEntry); struct dirent* dirEntry = readdir((DIR *) dir);
if (err || !dirEntry) if (!dirEntry)
break; break;
char* entryName = (char *) dirEntry->d_name; char* entryName = (char *) dirEntry->d_name;
const char filePath[50]; const char filePath[50];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment