Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MojitOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
MojitOS
Commits
8709019f
Commit
8709019f
authored
2 years ago
by
ghuter
Browse files
Options
Downloads
Patches
Plain Diff
compare new dev name to all saved ones
parent
5b826672
Branches
Branches containing commit
No related tags found
2 merge requests
!9
fix sensor example (doc)
,
!5
Add dev name to labels
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/network.c
+11
-1
11 additions, 1 deletion
src/network.c
with
11 additions
and
1 deletion
src/network.c
+
11
−
1
View file @
8709019f
...
@@ -64,6 +64,10 @@ static void _get_network(uint64_t *results, int *sources)
...
@@ -64,6 +64,10 @@ static void _get_network(uint64_t *results, int *sources)
}
}
}
}
/*
* read from fd len chars and store them into buf
* make *s points to the first occurence of c into buf
*/
static
int
strchr_refill
(
int
fd
,
char
*
buf
,
int
len
,
char
**
s
,
char
c
)
static
int
strchr_refill
(
int
fd
,
char
*
buf
,
int
len
,
char
**
s
,
char
c
)
{
{
*
s
=
strchr
(
*
s
,
c
);
*
s
=
strchr
(
*
s
,
c
);
...
@@ -152,7 +156,13 @@ unsigned int init_network(char *dev, void **ptr)
...
@@ -152,7 +156,13 @@ unsigned int init_network(char *dev, void **ptr)
}
}
/* compare dev name to the previously saved one */
/* compare dev name to the previously saved one */
if
(
strncmp
(
start_of_dev
,
state
->
devs
[
state
->
ndev
-
1
],
s
-
start_of_dev
)
!=
0
)
{
int
newdev
=
1
;
for
(
int
i
=
0
;
i
<
state
->
ndev
&&
newdev
;
i
++
)
{
if
(
strncmp
(
start_of_dev
,
state
->
devs
[
i
],
s
-
start_of_dev
)
==
0
)
{
newdev
=
0
;
}
}
if
(
newdev
)
{
if
(
state
->
ndev
>=
NB_MAX_DEV
)
{
if
(
state
->
ndev
>=
NB_MAX_DEV
)
{
fprintf
(
stderr
,
"Maximum amount of network devices exceeded (%d).
\n
"
,
NB_MAX_DEV
);
fprintf
(
stderr
,
"Maximum amount of network devices exceeded (%d).
\n
"
,
NB_MAX_DEV
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment