Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
htop
Commits
f205f700
Commit
f205f700
authored
7 years ago
by
Hisham Muhammad
Browse files
Options
Download
Email Patches
Plain Diff
Use regular readdir since readdir_r is deprecated and newer GCC complains.
parent
e940aecf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
linux/Battery.c
+6
-12
linux/Battery.c
with
6 additions
and
12 deletions
+6
-12
linux/Battery.c
View file @
f205f700
...
...
@@ -41,11 +41,9 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
unsigned
int
nBatteries
=
0
;
memset
(
batteries
,
0
,
MAX_BATTERIES
*
sizeof
(
char
*
));
struct
dirent
result
;
struct
dirent
*
dirEntry
;
while
(
nBatteries
<
MAX_BATTERIES
)
{
int
err
=
readdir
_r
(
batteryDir
,
&
result
,
&
dirEntry
);
if
(
err
||
!
dirEntry
)
struct
dirent
*
dirEntry
=
readdir
(
batteryDir
);
if
(
!
dirEntry
)
break
;
char
*
entryName
=
dirEntry
->
d_name
;
if
(
strncmp
(
entryName
,
"BAT"
,
3
))
...
...
@@ -97,11 +95,9 @@ static ACPresence procAcpiCheck() {
return
AC_ERROR
;
}
struct
dirent
result
;
struct
dirent
*
dirEntry
;
for
(;;)
{
int
err
=
readdir
_r
((
DIR
*
)
dir
,
&
result
,
&
dirEntry
);
if
(
err
||
!
dirEntry
)
struct
dirent
*
dirEntry
=
readdir
((
DIR
*
)
dir
);
if
(
!
dirEntry
)
break
;
char
*
entryName
=
(
char
*
)
dirEntry
->
d_name
;
...
...
@@ -191,11 +187,9 @@ static void Battery_getSysData(double* level, ACPresence* isOnAC) {
unsigned
long
int
totalFull
=
0
;
unsigned
long
int
totalRemain
=
0
;
struct
dirent
result
;
struct
dirent
*
dirEntry
;
for
(;;)
{
int
err
=
readdir
_r
((
DIR
*
)
dir
,
&
result
,
&
dirEntry
);
if
(
err
||
!
dirEntry
)
struct
dirent
*
dirEntry
=
readdir
((
DIR
*
)
dir
);
if
(
!
dirEntry
)
break
;
char
*
entryName
=
(
char
*
)
dirEntry
->
d_name
;
const
char
filePath
[
50
];
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help