Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
iproute2
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
iproute2
Commits
b482ffa6
Commit
b482ffa6
authored
Oct 19, 2004
by
net[shemminger]!shemminger
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Import patch nstat.eml
(Logical change 1.97)
parent
b2ff22ee
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
misc/nstat.c
misc/nstat.c
+12
-6
No files found.
misc/nstat.c
View file @
b482ffa6
...
...
@@ -121,14 +121,16 @@ void load_good_table(FILE *fp)
int
nr
;
unsigned
long
long
val
;
double
rate
;
char
idbuf
[
256
];
char
idbuf
[
sizeof
(
buf
)
];
if
(
buf
[
0
]
==
'#'
)
{
buf
[
strlen
(
buf
)
-
1
]
=
0
;
if
(
info_source
[
0
]
&&
strcmp
(
info_source
,
buf
+
1
))
source_mismatch
=
1
;
strncpy
(
info_source
,
buf
+
1
,
sizeof
(
info_source
)
-
1
);
info_source
[
0
]
=
0
;
strncat
(
info_source
,
buf
+
1
,
sizeof
(
info_source
)
-
1
);
continue
;
}
/* idbuf is as big as buf, so this is safe */
nr
=
sscanf
(
buf
,
"%s%llu%lg"
,
idbuf
,
&
val
,
&
rate
);
if
(
nr
<
2
)
abort
();
...
...
@@ -162,7 +164,7 @@ void load_ugly_table(FILE *fp)
struct
nstat_ent
*
n
;
while
(
fgets
(
buf
,
sizeof
(
buf
),
fp
)
!=
NULL
)
{
char
idbuf
[
256
];
char
idbuf
[
sizeof
(
buf
)
];
int
off
;
char
*
p
;
...
...
@@ -170,8 +172,9 @@ void load_ugly_table(FILE *fp)
if
(
!
p
)
abort
();
*
p
=
0
;
strcpy
(
idbuf
,
buf
);
off
=
strlen
(
idbuf
);
idbuf
[
0
]
=
0
;
strncat
(
idbuf
,
buf
,
sizeof
(
idbuf
)
-
1
);
off
=
p
-
buf
;
p
+=
2
;
while
(
*
p
)
{
...
...
@@ -180,7 +183,10 @@ void load_ugly_table(FILE *fp)
*
next
++
=
0
;
else
if
((
next
=
strchr
(
p
,
'\n'
))
!=
NULL
)
*
next
++
=
0
;
strcpy
(
idbuf
+
off
,
p
);
if
(
off
<
sizeof
(
idbuf
))
{
idbuf
[
off
]
=
0
;
strncat
(
idbuf
,
p
,
sizeof
(
idbuf
)
-
off
-
1
);
}
n
=
malloc
(
sizeof
(
*
n
));
if
(
!
n
)
abort
();
...
...
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