Skip to content
GitLab
Menu
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
1371ee28
Commit
1371ee28
authored
Jun 02, 2009
by
Hisham Muhammad
Browse files
don't use unbounded operations
parent
b62f9cea
Changes
1
Show whitespace changes
Inline
Side-by-side
BatteryMeter.c
View file @
1371ee28
...
...
@@ -86,7 +86,7 @@ static unsigned long int parseBatInfo(const char *fileName, const unsigned short
const
FILE
*
file
;
char
line
[
50
];
sprintf
((
char
*
)
infoPath
,
"%s%s/%s"
,
batteryPath
,
newEntry
->
content
,
fileName
);
s
n
printf
((
char
*
)
infoPath
,
sizeof
infoPath
,
"%s%s/%s"
,
batteryPath
,
newEntry
->
content
,
fileName
);
if
((
file
=
fopen
(
infoPath
,
"r"
))
==
NULL
)
{
return
0
;
...
...
@@ -135,7 +135,7 @@ static ACPresence chkIsOnline() {
char
statePath
[
50
];
sprintf
((
char
*
)
statePath
,
"%s/%s/state"
,
power_supplyPath
,
entryName
);
s
n
printf
((
char
*
)
statePath
,
sizeof
statePath
,
"%s/%s/state"
,
power_supplyPath
,
entryName
);
file
=
fopen
(
statePath
,
"r"
);
if
(
!
file
)
{
...
...
@@ -190,7 +190,7 @@ static ACPresence chkIsOnline() {
}
char
onlinePath
[
50
];
sprintf
((
char
*
)
onlinePath
,
"%s/%s/online"
,
power_supplyPath
,
entryName
);
s
n
printf
((
char
*
)
onlinePath
,
sizeof
onlinePath
,
"%s/%s/online"
,
power_supplyPath
,
entryName
);
file
=
fopen
(
onlinePath
,
"r"
);
if
(
!
file
)
{
...
...
@@ -264,7 +264,7 @@ static double getSysBatData() {
const
char
ueventPath
[
50
];
sprintf
((
char
*
)
ueventPath
,
"%s%s/uevent"
,
power_supplyPath
,
entryName
);
s
n
printf
((
char
*
)
ueventPath
,
sizeof
ueventPath
,
"%s%s/uevent"
,
power_supplyPath
,
entryName
);
FILE
*
file
;
if
((
file
=
fopen
(
ueventPath
,
"r"
))
==
NULL
)
{
...
...
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