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
fb398f07
Unverified
Commit
fb398f07
authored
Dec 06, 2017
by
Stéphane Graber
Committed by
GitHub
Dec 06, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2007 from brauner/2017-12-06/bugfixes
coverity: bugfixes
parents
49be8a14
070a05af
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
98 additions
and
254 deletions
+98
-254
cgfsng.c
src/lxc/cgroups/cgfsng.c
+1
-1
confile.c
src/lxc/confile.c
+75
-240
confile_legacy.c
src/lxc/confile_legacy.c
+5
-1
lxccontainer.c
src/lxc/lxccontainer.c
+5
-4
overlay.c
src/lxc/storage/overlay.c
+1
-1
rsync.c
src/lxc/storage/rsync.c
+1
-0
snapshot.c
src/tests/snapshot.c
+10
-7
No files found.
src/lxc/cgroups/cgfsng.c
View file @
fb398f07
...
...
@@ -1388,7 +1388,7 @@ again:
ret
=
snprintf
(
offset
,
5
,
"-%d"
,
idx
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
5
)
{
FILE
*
f
=
fopen
(
"/dev/null"
,
"w"
);
if
(
f
>=
0
)
{
if
(
f
)
{
fprintf
(
f
,
"Workaround for GCC7 bug: "
"https://gcc.gnu.org/bugzilla/"
"show_bug.cgi?id=78969"
);
...
...
src/lxc/confile.c
View file @
fb398f07
...
...
@@ -382,15 +382,11 @@ static int set_config_net(const char *key, const char *value,
static
int
set_config_net_type
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_type
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -419,15 +415,11 @@ static int set_config_net_type(const char *key, const char *value,
static
int
set_config_net_flags
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_flags
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -483,16 +475,12 @@ static int create_matched_ifnames(const char *value, struct lxc_conf *lxc_conf,
static
int
set_config_net_link
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
int
ret
=
0
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_link
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -507,15 +495,11 @@ static int set_config_net_link(const char *key, const char *value,
static
int
set_config_net_name
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_name
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -525,15 +509,11 @@ static int set_config_net_name(const char *key, const char *value,
static
int
set_config_net_veth_pair
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_veth_pair
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -543,15 +523,11 @@ static int set_config_net_veth_pair(const char *key, const char *value,
static
int
set_config_net_macvlan_mode
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_macvlan_mode
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -561,16 +537,12 @@ static int set_config_net_macvlan_mode(const char *key, const char *value,
static
int
set_config_net_hwaddr
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
char
*
new_value
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_hwaddr
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -594,15 +566,11 @@ static int set_config_net_vlan_id(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_vlan_id
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -616,15 +584,11 @@ static int set_config_net_vlan_id(const char *key, const char *value,
static
int
set_config_net_mtu
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_mtu
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -635,7 +599,7 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
struct
lxc_inetdev
*
inetdev
;
struct
lxc_list
*
list
;
char
*
cursor
,
*
slash
;
...
...
@@ -644,10 +608,6 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_ipv4_address
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -732,15 +692,11 @@ static int set_config_net_ipv4_address(const char *key, const char *value,
static
int
set_config_net_ipv4_gateway
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_ipv4_gateway
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -775,7 +731,7 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
int
ret
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
struct
lxc_inet6dev
*
inet6dev
;
struct
lxc_list
*
list
;
char
*
slash
,
*
valdup
,
*
netmask
;
...
...
@@ -783,10 +739,6 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_ipv6_address
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -839,15 +791,11 @@ static int set_config_net_ipv6_address(const char *key, const char *value,
static
int
set_config_net_ipv6_gateway
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_ipv6_gateway
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -881,15 +829,11 @@ static int set_config_net_ipv6_gateway(const char *key, const char *value,
static
int
set_config_net_script_up
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_script_up
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -899,15 +843,11 @@ static int set_config_net_script_up(const char *key, const char *value,
static
int
set_config_net_script_down
(
const
char
*
key
,
const
char
*
value
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
lxc_config_value_empty
(
value
))
return
clr_config_net_script_down
(
key
,
lxc_conf
,
data
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -3924,12 +3864,8 @@ static int clr_config_net_nic(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_type
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -3941,12 +3877,8 @@ static int clr_config_net_type(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_name
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -3958,12 +3890,8 @@ static int clr_config_net_name(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_flags
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -3975,12 +3903,8 @@ static int clr_config_net_flags(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_link
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -3992,12 +3916,8 @@ static int clr_config_net_link(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_macvlan_mode
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4012,12 +3932,8 @@ static int clr_config_net_macvlan_mode(const char *key,
static
int
clr_config_net_veth_pair
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4029,12 +3945,8 @@ static int clr_config_net_veth_pair(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_script_up
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4047,12 +3959,8 @@ static int clr_config_net_script_up(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_script_down
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4065,12 +3973,8 @@ static int clr_config_net_script_down(const char *key,
static
int
clr_config_net_hwaddr
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4083,12 +3987,8 @@ static int clr_config_net_hwaddr(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_mtu
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4101,12 +4001,8 @@ static int clr_config_net_mtu(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_vlan_id
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4118,12 +4014,8 @@ static int clr_config_net_vlan_id(const char *key, struct lxc_conf *lxc_conf,
static
int
clr_config_net_ipv4_gateway
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4136,13 +4028,9 @@ static int clr_config_net_ipv4_gateway(const char *key,
static
int
clr_config_net_ipv4_address
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
struct
lxc_list
*
cur
,
*
next
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4158,12 +4046,8 @@ static int clr_config_net_ipv4_address(const char *key,
static
int
clr_config_net_ipv6_gateway
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4176,13 +4060,9 @@ static int clr_config_net_ipv6_gateway(const char *key,
static
int
clr_config_net_ipv6_address
(
const
char
*
key
,
struct
lxc_conf
*
lxc_conf
,
void
*
data
)
{
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
struct
lxc_list
*
cur
,
*
next
;
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4227,18 +4107,15 @@ static int get_config_net_nic(const char *key, char *retv, int inlen,
static
int
get_config_net_type
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4250,18 +4127,15 @@ static int get_config_net_type(const char *key, char *retv, int inlen,
static
int
get_config_net_flags
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4274,18 +4148,15 @@ static int get_config_net_flags(const char *key, char *retv, int inlen,
static
int
get_config_net_link
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4298,18 +4169,15 @@ static int get_config_net_link(const char *key, char *retv, int inlen,
static
int
get_config_net_name
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4322,19 +4190,16 @@ static int get_config_net_name(const char *key, char *retv, int inlen,
static
int
get_config_net_macvlan_mode
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
;
int
fulllen
=
0
;
const
char
*
mode
;
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4367,18 +4232,15 @@ static int get_config_net_macvlan_mode(const char *key, char *retv, int inlen,
static
int
get_config_net_veth_pair
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4396,18 +4258,15 @@ static int get_config_net_veth_pair(const char *key, char *retv, int inlen,
static
int
get_config_net_script_up
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4420,18 +4279,15 @@ static int get_config_net_script_up(const char *key, char *retv, int inlen,
static
int
get_config_net_script_down
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4444,18 +4300,15 @@ static int get_config_net_script_down(const char *key, char *retv, int inlen,
static
int
get_config_net_hwaddr
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4468,18 +4321,15 @@ static int get_config_net_hwaddr(const char *key, char *retv, int inlen,
static
int
get_config_net_mtu
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4492,18 +4342,15 @@ static int get_config_net_mtu(const char *key, char *retv, int inlen,
static
int
get_config_net_vlan_id
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
struct
lxc_netdev
*
netdev
;
int
len
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4518,19 +4365,16 @@ static int get_config_net_vlan_id(const char *key, char *retv, int inlen,
static
int
get_config_net_ipv4_gateway
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
int
len
;
char
buf
[
INET_ADDRSTRLEN
];
struct
lxc_netdev
*
netdev
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4547,21 +4391,18 @@ static int get_config_net_ipv4_gateway(const char *key, char *retv, int inlen,
static
int
get_config_net_ipv4_address
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
int
len
;
size_t
listlen
;
char
buf
[
INET_ADDRSTRLEN
];
struct
lxc_netdev
*
netdev
;
struct
lxc_list
*
it
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4579,19 +4420,16 @@ static int get_config_net_ipv4_address(const char *key, char *retv, int inlen,
static
int
get_config_net_ipv6_gateway
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
int
len
;
char
buf
[
INET6_ADDRSTRLEN
];
struct
lxc_netdev
*
netdev
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
@@ -4608,21 +4446,18 @@ static int get_config_net_ipv6_gateway(const char *key, char *retv, int inlen,
static
int
get_config_net_ipv6_address
(
const
char
*
key
,
char
*
retv
,
int
inlen
,
struct
lxc_conf
*
c
,
void
*
data
)
{
int
len
,
fulllen
=
0
;
int
len
;
size_t
listlen
;
char
buf
[
INET6_ADDRSTRLEN
];
struct
lxc_netdev
*
netdev
;
struct
lxc_list
*
it
;
int
fulllen
=
0
;
struct
lxc_netdev
*
netdev
=
data
;
if
(
!
retv
)
inlen
=
0
;
else
memset
(
retv
,
0
,
inlen
);
if
(
!
data
)
return
-
1
;
else
netdev
=
data
;
if
(
!
netdev
)
return
-
1
;
...
...
src/lxc/confile_legacy.c
View file @
fb398f07
...
...
@@ -713,8 +713,12 @@ int set_config_network_legacy_ipv6(const char *key, const char *value,
if
(
slash
)
{
*
slash
=
'\0'
;
netmask
=
slash
+
1
;
if
(
lxc_safe_uint
(
netmask
,
&
inet6dev
->
prefix
)
<
0
)
if
(
lxc_safe_uint
(
netmask
,
&
inet6dev
->
prefix
)
<
0
)
{
free
(
list
);
free
(
inet6dev
);
free
(
valdup
);
return
-
1
;
}
}
if
(
!
inet_pton
(
AF_INET6
,
valdup
,
&
inet6dev
->
addr
))
{
...
...
src/lxc/lxccontainer.c
View file @
fb398f07
...
...
@@ -4463,7 +4463,7 @@ WRAP_API_2(bool, lxcapi_detach_interface, const char *, const char *)
static
int
do_lxcapi_migrate
(
struct
lxc_container
*
c
,
unsigned
int
cmd
,
struct
migrate_opts
*
opts
,
unsigned
int
size
)
{
int
ret
;
int
ret
=
-
1
;
struct
migrate_opts
*
valid_opts
=
opts
;
/* If the caller has a bigger (newer) struct migrate_opts, let's make
...
...
@@ -4500,21 +4500,21 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
case
MIGRATE_PRE_DUMP
:
if
(
!
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is not running"
);
return
false
;
goto
on_error
;
}
ret
=
!
__criu_pre_dump
(
c
,
valid_opts
);
break
;
case
MIGRATE_DUMP
:
if
(
!
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is not running"
);
return
false
;
goto
on_error
;
}
ret
=
!
__criu_dump
(
c
,
valid_opts
);
break
;
case
MIGRATE_RESTORE
:
if
(
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is already running"
);
return
false
;
goto
on_error
;
}
ret
=
!
__criu_restore
(
c
,
valid_opts
);
break
;
...
...
@@ -4523,6 +4523,7 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
ret
=
-
EINVAL
;
}
on_error
:
if
(
size
<
sizeof
(
*
opts
))
free
(
valid_opts
);
...
...
src/lxc/storage/overlay.c
View file @
fb398f07
...
...
@@ -545,7 +545,7 @@ int ovl_mount(struct lxc_storage *bdev)
upper
++
;
/* if delta doesn't yet exist, create it */
ret
=
mkdir_p
(
upper
,
0755
)
<
0
;
ret
=
mkdir_p
(
upper
,
0755
);
if
(
ret
<
0
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"Failed to create directory
\"
%s
\"
"
,
upper
);
free
(
dup
);
...
...
src/lxc/storage/rsync.c
View file @
fb398f07
...
...
@@ -80,6 +80,7 @@ int lxc_rsync_exec(const char *src, const char *dest)
s
[
l
-
1
]
=
'\0'
;
execlp
(
"rsync"
,
"rsync"
,
"-aHXS"
,
"--delete"
,
s
,
dest
,
(
char
*
)
NULL
);
free
(
s
);
return
-
1
;
}
...
...
src/tests/snapshot.c
View file @
fb398f07
...
...
@@ -55,6 +55,10 @@ static void try_to_remove(void)
int
main
(
int
argc
,
char
*
argv
[])
{
int
i
,
n
,
ret
;
char
path
[
1024
];
struct
stat
sb
;
struct
lxc_snapshot
*
s
;
struct
lxc_container
*
c
,
*
c2
=
NULL
;
char
*
template
=
"busybox"
;
...
...
@@ -89,19 +93,18 @@ int main(int argc, char *argv[])
}
// rootfs should be ${lxcpath}${lxcname}/snaps/snap0/rootfs
struct
stat
sb
;
int
ret
;
char
path
[
1024
];
snprintf
(
path
,
1024
,
"%s/%s/snaps/snap0/rootfs"
,
lxc_get_global_config_item
(
"lxc.lxcpath"
),
MYNAME
);
ret
=
snprintf
(
path
,
1024
,
"%s/%s/snaps/snap0/rootfs"
,
lxc_get_global_config_item
(
"lxc.lxcpath"
),
MYNAME
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
1024
)
{
fprintf
(
stderr
,
"%s: %d: failed to create string
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
ret
=
stat
(
path
,
&
sb
);
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"%s: %d: snapshot was not actually created
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
}
struct
lxc_snapshot
*
s
;
int
i
,
n
;
n
=
c
->
snapshot_list
(
c
,
&
s
);
if
(
n
<
1
)
{
fprintf
(
stderr
,
"%s: %d: failed listing containers
\n
"
,
__FILE__
,
__LINE__
);
...
...
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