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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
14 deletions
+23
-14
cgfsng.c
src/lxc/cgroups/cgfsng.c
+1
-1
confile.c
src/lxc/confile.c
+0
-0
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:
...
@@ -1388,7 +1388,7 @@ again:
ret
=
snprintf
(
offset
,
5
,
"-%d"
,
idx
);
ret
=
snprintf
(
offset
,
5
,
"-%d"
,
idx
);
if
(
ret
<
0
||
(
size_t
)
ret
>=
5
)
{
if
(
ret
<
0
||
(
size_t
)
ret
>=
5
)
{
FILE
*
f
=
fopen
(
"/dev/null"
,
"w"
);
FILE
*
f
=
fopen
(
"/dev/null"
,
"w"
);
if
(
f
>=
0
)
{
if
(
f
)
{
fprintf
(
f
,
"Workaround for GCC7 bug: "
fprintf
(
f
,
"Workaround for GCC7 bug: "
"https://gcc.gnu.org/bugzilla/"
"https://gcc.gnu.org/bugzilla/"
"show_bug.cgi?id=78969"
);
"show_bug.cgi?id=78969"
);
...
...
src/lxc/confile.c
View file @
fb398f07
This diff is collapsed.
Click to expand it.
src/lxc/confile_legacy.c
View file @
fb398f07
...
@@ -713,8 +713,12 @@ int set_config_network_legacy_ipv6(const char *key, const char *value,
...
@@ -713,8 +713,12 @@ int set_config_network_legacy_ipv6(const char *key, const char *value,
if
(
slash
)
{
if
(
slash
)
{
*
slash
=
'\0'
;
*
slash
=
'\0'
;
netmask
=
slash
+
1
;
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
;
return
-
1
;
}
}
}
if
(
!
inet_pton
(
AF_INET6
,
valdup
,
&
inet6dev
->
addr
))
{
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 *)
...
@@ -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
,
static
int
do_lxcapi_migrate
(
struct
lxc_container
*
c
,
unsigned
int
cmd
,
struct
migrate_opts
*
opts
,
unsigned
int
size
)
struct
migrate_opts
*
opts
,
unsigned
int
size
)
{
{
int
ret
;
int
ret
=
-
1
;
struct
migrate_opts
*
valid_opts
=
opts
;
struct
migrate_opts
*
valid_opts
=
opts
;
/* If the caller has a bigger (newer) struct migrate_opts, let's make
/* 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,
...
@@ -4500,21 +4500,21 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
case
MIGRATE_PRE_DUMP
:
case
MIGRATE_PRE_DUMP
:
if
(
!
do_lxcapi_is_running
(
c
))
{
if
(
!
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is not running"
);
ERROR
(
"container is not running"
);
return
false
;
goto
on_error
;
}
}
ret
=
!
__criu_pre_dump
(
c
,
valid_opts
);
ret
=
!
__criu_pre_dump
(
c
,
valid_opts
);
break
;
break
;
case
MIGRATE_DUMP
:
case
MIGRATE_DUMP
:
if
(
!
do_lxcapi_is_running
(
c
))
{
if
(
!
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is not running"
);
ERROR
(
"container is not running"
);
return
false
;
goto
on_error
;
}
}
ret
=
!
__criu_dump
(
c
,
valid_opts
);
ret
=
!
__criu_dump
(
c
,
valid_opts
);
break
;
break
;
case
MIGRATE_RESTORE
:
case
MIGRATE_RESTORE
:
if
(
do_lxcapi_is_running
(
c
))
{
if
(
do_lxcapi_is_running
(
c
))
{
ERROR
(
"container is already running"
);
ERROR
(
"container is already running"
);
return
false
;
goto
on_error
;
}
}
ret
=
!
__criu_restore
(
c
,
valid_opts
);
ret
=
!
__criu_restore
(
c
,
valid_opts
);
break
;
break
;
...
@@ -4523,6 +4523,7 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
...
@@ -4523,6 +4523,7 @@ static int do_lxcapi_migrate(struct lxc_container *c, unsigned int cmd,
ret
=
-
EINVAL
;
ret
=
-
EINVAL
;
}
}
on_error
:
if
(
size
<
sizeof
(
*
opts
))
if
(
size
<
sizeof
(
*
opts
))
free
(
valid_opts
);
free
(
valid_opts
);
...
...
src/lxc/storage/overlay.c
View file @
fb398f07
...
@@ -545,7 +545,7 @@ int ovl_mount(struct lxc_storage *bdev)
...
@@ -545,7 +545,7 @@ int ovl_mount(struct lxc_storage *bdev)
upper
++
;
upper
++
;
/* if delta doesn't yet exist, create it */
/* if delta doesn't yet exist, create it */
ret
=
mkdir_p
(
upper
,
0755
)
<
0
;
ret
=
mkdir_p
(
upper
,
0755
);
if
(
ret
<
0
&&
errno
!=
EEXIST
)
{
if
(
ret
<
0
&&
errno
!=
EEXIST
)
{
SYSERROR
(
"Failed to create directory
\"
%s
\"
"
,
upper
);
SYSERROR
(
"Failed to create directory
\"
%s
\"
"
,
upper
);
free
(
dup
);
free
(
dup
);
...
...
src/lxc/storage/rsync.c
View file @
fb398f07
...
@@ -80,6 +80,7 @@ int lxc_rsync_exec(const char *src, const char *dest)
...
@@ -80,6 +80,7 @@ int lxc_rsync_exec(const char *src, const char *dest)
s
[
l
-
1
]
=
'\0'
;
s
[
l
-
1
]
=
'\0'
;
execlp
(
"rsync"
,
"rsync"
,
"-aHXS"
,
"--delete"
,
s
,
dest
,
(
char
*
)
NULL
);
execlp
(
"rsync"
,
"rsync"
,
"-aHXS"
,
"--delete"
,
s
,
dest
,
(
char
*
)
NULL
);
free
(
s
);
return
-
1
;
return
-
1
;
}
}
...
...
src/tests/snapshot.c
View file @
fb398f07
...
@@ -55,6 +55,10 @@ static void try_to_remove(void)
...
@@ -55,6 +55,10 @@ static void try_to_remove(void)
int
main
(
int
argc
,
char
*
argv
[])
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
;
struct
lxc_container
*
c
,
*
c2
=
NULL
;
char
*
template
=
"busybox"
;
char
*
template
=
"busybox"
;
...
@@ -89,19 +93,18 @@ int main(int argc, char *argv[])
...
@@ -89,19 +93,18 @@ int main(int argc, char *argv[])
}
}
// rootfs should be ${lxcpath}${lxcname}/snaps/snap0/rootfs
// rootfs should be ${lxcpath}${lxcname}/snaps/snap0/rootfs
struct
stat
sb
;
ret
=
snprintf
(
path
,
1024
,
"%s/%s/snaps/snap0/rootfs"
,
lxc_get_global_config_item
(
"lxc.lxcpath"
),
MYNAME
);
int
ret
;
if
(
ret
<
0
||
(
size_t
)
ret
>=
1024
)
{
char
path
[
1024
];
fprintf
(
stderr
,
"%s: %d: failed to create string
\n
"
,
__FILE__
,
__LINE__
);
snprintf
(
path
,
1024
,
"%s/%s/snaps/snap0/rootfs"
,
lxc_get_global_config_item
(
"lxc.lxcpath"
),
MYNAME
);
goto
err
;
}
ret
=
stat
(
path
,
&
sb
);
ret
=
stat
(
path
,
&
sb
);
if
(
ret
!=
0
)
{
if
(
ret
!=
0
)
{
fprintf
(
stderr
,
"%s: %d: snapshot was not actually created
\n
"
,
__FILE__
,
__LINE__
);
fprintf
(
stderr
,
"%s: %d: snapshot was not actually created
\n
"
,
__FILE__
,
__LINE__
);
goto
err
;
goto
err
;
}
}
struct
lxc_snapshot
*
s
;
int
i
,
n
;
n
=
c
->
snapshot_list
(
c
,
&
s
);
n
=
c
->
snapshot_list
(
c
,
&
s
);
if
(
n
<
1
)
{
if
(
n
<
1
)
{
fprintf
(
stderr
,
"%s: %d: failed listing containers
\n
"
,
__FILE__
,
__LINE__
);
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