Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
6ca55194
Unverified
Commit
6ca55194
authored
Dec 08, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
confile: cleanup clr_config_net_nic()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
d3f6eaac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
confile.c
src/lxc/confile.c
+10
-14
No files found.
src/lxc/confile.c
View file @
6ca55194
...
@@ -4792,16 +4792,16 @@ static int set_config_net_nic(const char *key, const char *value,
...
@@ -4792,16 +4792,16 @@ static int set_config_net_nic(const char *key, const char *value,
static
int
clr_config_net_nic
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
static
int
clr_config_net_nic
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
void
*
data
)
{
{
__do_free
char
*
deindexed_key
=
NULL
;
ssize_t
idx
=
-
1
;
int
ret
;
int
ret
;
const
char
*
idxstring
;
const
char
*
idxstring
;
struct
lxc_config_t
*
config
;
struct
lxc_config_t
*
config
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
ssize_t
idx
=
-
1
;
char
*
deindexed_key
=
NULL
;
idxstring
=
key
+
8
;
idxstring
=
key
+
8
;
if
(
!
isdigit
(
*
idxstring
))
if
(
!
isdigit
(
*
idxstring
))
return
-
1
;
return
ret_errno
(
EINVAL
)
;
/* The left conjunct is pretty self-explanatory. The right conjunct
/* The left conjunct is pretty self-explanatory. The right conjunct
* checks whether the two pointers are equal. If they are we know that
* checks whether the two pointers are equal. If they are we know that
...
@@ -4811,8 +4811,9 @@ static int clr_config_net_nic(const char *key, struct lxc_conf *lxc_conf,
...
@@ -4811,8 +4811,9 @@ static int clr_config_net_nic(const char *key, struct lxc_conf *lxc_conf,
if
(
isdigit
(
*
idxstring
)
&&
(
strrchr
(
key
,
'.'
)
==
(
idxstring
-
1
)))
{
if
(
isdigit
(
*
idxstring
)
&&
(
strrchr
(
key
,
'.'
)
==
(
idxstring
-
1
)))
{
unsigned
int
rmnetdevidx
;
unsigned
int
rmnetdevidx
;
if
(
lxc_safe_uint
(
idxstring
,
&
rmnetdevidx
)
<
0
)
ret
=
lxc_safe_uint
(
idxstring
,
&
rmnetdevidx
);
return
-
1
;
if
(
ret
<
0
)
return
ret
;
/* Remove network from network list. */
/* Remove network from network list. */
lxc_remove_nic_by_idx
(
lxc_conf
,
rmnetdevidx
);
lxc_remove_nic_by_idx
(
lxc_conf
,
rmnetdevidx
);
...
@@ -4821,18 +4822,13 @@ static int clr_config_net_nic(const char *key, struct lxc_conf *lxc_conf,
...
@@ -4821,18 +4822,13 @@ static int clr_config_net_nic(const char *key, struct lxc_conf *lxc_conf,
config
=
get_network_config_ops
(
key
,
lxc_conf
,
&
idx
,
&
deindexed_key
);
config
=
get_network_config_ops
(
key
,
lxc_conf
,
&
idx
,
&
deindexed_key
);
if
(
!
config
||
idx
<
0
)
if
(
!
config
||
idx
<
0
)
return
-
1
;
return
-
errno
;
netdev
=
lxc_get_netdev_by_idx
(
lxc_conf
,
(
unsigned
int
)
idx
,
false
);
netdev
=
lxc_get_netdev_by_idx
(
lxc_conf
,
(
unsigned
int
)
idx
,
false
);
if
(
!
netdev
)
{
if
(
!
netdev
)
free
(
deindexed_key
);
return
ret_errno
(
EINVAL
);
return
-
1
;
}
ret
=
config
->
clr
(
deindexed_key
,
lxc_conf
,
netdev
);
free
(
deindexed_key
);
return
ret
;
return
config
->
clr
(
deindexed_key
,
lxc_conf
,
netdev
)
;
}
}
static
int
clr_config_net_type
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
static
int
clr_config_net_type
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
...
...
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