Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
net-tools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
net-tools
Commits
73cef8a8
Commit
73cef8a8
authored
Aug 29, 2015
by
Mike Frysinger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
statistics: use getline instead of fgets
This way we can support any length line w/out hardcoded buffer limits.
parent
d9232120
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
statistics.c
statistics.c
+5
-3
No files found.
statistics.c
View file @
73cef8a8
...
...
@@ -411,16 +411,18 @@ static const struct tabtab *newtable(const struct tabtab *tabs, const char *titl
static
int
process_fd
(
FILE
*
f
,
int
all
,
const
char
*
filter
)
{
size_t
filter_len
=
filter
?
strlen
(
filter
)
:
0
;
char
buf1
[
2048
],
buf2
[
2048
];
static
char
*
buf1
,
*
buf2
;
static
size_t
buf1_len
,
buf2_len
;
char
*
sp
,
*
np
,
*
p
;
while
(
fgets
(
buf1
,
sizeof
buf1
,
f
))
{
while
(
getline
(
&
buf1
,
&
buf1_len
,
f
)
>
0
)
{
int
endflag
;
const
struct
tabtab
*
tab
;
if
(
buf1
[
0
]
==
'\n'
)
// skip empty first line in 2.6 kernels
continue
;
if
(
!
fgets
(
buf2
,
sizeof
buf2
,
f
)
)
if
(
getline
(
&
buf2
,
&
buf2_len
,
f
)
<=
0
)
break
;
sp
=
strchr
(
buf1
,
':'
);
np
=
strchr
(
buf2
,
':'
);
...
...
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