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
ba2861ff
Unverified
Commit
ba2861ff
authored
Feb 09, 2018
by
Stéphane Graber
Committed by
GitHub
Feb 09, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2144 from brauner/2018-02-08/coverity_bug_smash
coverity: bug smash
parents
056fec39
287df277
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
12 additions
and
7 deletions
+12
-7
cgfs.c
src/lxc/cgroups/cgfs.c
+2
-0
cgfsng.c
src/lxc/cgroups/cgfsng.c
+1
-0
lxccontainer.c
src/lxc/lxccontainer.c
+2
-2
monitor.c
src/lxc/monitor.c
+0
-1
start.c
src/lxc/start.c
+6
-3
share_ns.c
src/tests/share_ns.c
+1
-1
No files found.
src/lxc/cgroups/cgfs.c
View file @
ba2861ff
...
@@ -523,6 +523,8 @@ static bool find_hierarchy_mountpts( struct cgroup_meta_data *meta_data, char **
...
@@ -523,6 +523,8 @@ static bool find_hierarchy_mountpts( struct cgroup_meta_data *meta_data, char **
}
}
}
}
lxc_free_array
((
void
**
)
subsystems
,
free
);
lxc_free_array
((
void
**
)
subsystems
,
free
);
if
(
!
h
)
goto
out
;
r
=
lxc_grow_array
((
void
***
)
&
meta_data
->
mount_points
,
&
mount_point_capacity
,
mount_point_count
+
1
,
12
);
r
=
lxc_grow_array
((
void
***
)
&
meta_data
->
mount_points
,
&
mount_point_capacity
,
mount_point_count
+
1
,
12
);
if
(
r
<
0
)
if
(
r
<
0
)
...
...
src/lxc/cgroups/cgfsng.c
View file @
ba2861ff
...
@@ -1143,6 +1143,7 @@ static bool cg_hybrid_init(void)
...
@@ -1143,6 +1143,7 @@ static bool cg_hybrid_init(void)
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
f
=
fopen
(
"/proc/self/mountinfo"
,
"r"
);
if
(
!
f
)
{
if
(
!
f
)
{
CGFSNG_DEBUG
(
"Failed to open
\"
/proc/self/mountinfo
\"\n
"
);
CGFSNG_DEBUG
(
"Failed to open
\"
/proc/self/mountinfo
\"\n
"
);
free
(
basecginfo
);
return
false
;
return
false
;
}
}
...
...
src/lxc/lxccontainer.c
View file @
ba2861ff
...
@@ -2727,7 +2727,7 @@ static bool container_destroy(struct lxc_container *c,
...
@@ -2727,7 +2727,7 @@ static bool container_destroy(struct lxc_container *c,
if
(
conf
&&
!
lxc_list_empty
(
&
conf
->
hooks
[
LXCHOOK_DESTROY
]))
{
if
(
conf
&&
!
lxc_list_empty
(
&
conf
->
hooks
[
LXCHOOK_DESTROY
]))
{
/* Start of environment variable setup for hooks */
/* Start of environment variable setup for hooks */
if
(
c
->
name
&&
setenv
(
"LXC_NAME"
,
c
->
name
,
1
))
if
(
setenv
(
"LXC_NAME"
,
c
->
name
,
1
))
SYSERROR
(
"Failed to set environment variable for container name"
);
SYSERROR
(
"Failed to set environment variable for container name"
);
if
(
conf
->
rcfile
&&
setenv
(
"LXC_CONFIG_FILE"
,
conf
->
rcfile
,
1
))
if
(
conf
->
rcfile
&&
setenv
(
"LXC_CONFIG_FILE"
,
conf
->
rcfile
,
1
))
...
@@ -3425,7 +3425,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
...
@@ -3425,7 +3425,7 @@ static int clone_update_rootfs(struct clone_update_data *data)
if
(
c0
->
name
&&
setenv
(
"LXC_SRC_NAME"
,
c0
->
name
,
1
))
{
if
(
c0
->
name
&&
setenv
(
"LXC_SRC_NAME"
,
c0
->
name
,
1
))
{
SYSERROR
(
"failed to set environment variable for source container name"
);
SYSERROR
(
"failed to set environment variable for source container name"
);
}
}
if
(
c
->
name
&&
setenv
(
"LXC_NAME"
,
c
->
name
,
1
))
{
if
(
setenv
(
"LXC_NAME"
,
c
->
name
,
1
))
{
SYSERROR
(
"failed to set environment variable for container name"
);
SYSERROR
(
"failed to set environment variable for container name"
);
}
}
if
(
conf
->
rcfile
&&
setenv
(
"LXC_CONFIG_FILE"
,
conf
->
rcfile
,
1
))
{
if
(
conf
->
rcfile
&&
setenv
(
"LXC_CONFIG_FILE"
,
conf
->
rcfile
,
1
))
{
...
...
src/lxc/monitor.c
View file @
ba2861ff
...
@@ -239,7 +239,6 @@ int lxc_monitor_open(const char *lxcpath)
...
@@ -239,7 +239,6 @@ int lxc_monitor_open(const char *lxcpath)
if
(
fd
<
0
)
{
if
(
fd
<
0
)
{
ERROR
(
"Failed to connect to monitor socket: %s."
,
strerror
(
errno
));
ERROR
(
"Failed to connect to monitor socket: %s."
,
strerror
(
errno
));
close
(
fd
);
return
-
1
;
return
-
1
;
}
}
...
...
src/lxc/start.c
View file @
ba2861ff
...
@@ -1660,14 +1660,17 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1660,14 +1660,17 @@ static int lxc_spawn(struct lxc_handler *handler)
DEBUG
(
"Preserved cgroup namespace via fd %d"
,
ret
);
DEBUG
(
"Preserved cgroup namespace via fd %d"
,
ret
);
}
}
snprintf
(
pidstr
,
20
,
"%d"
,
handler
->
pid
);
ret
=
snprintf
(
pidstr
,
20
,
"%d"
,
handler
->
pid
);
if
(
ret
<
0
||
ret
>=
20
)
goto
out_delete_net
;
if
(
setenv
(
"LXC_PID"
,
pidstr
,
1
))
if
(
setenv
(
"LXC_PID"
,
pidstr
,
1
))
SYSERROR
(
"Failed to set environment variable: LXC_PID=%s."
,
pidstr
);
SYSERROR
(
"Failed to set environment variable: LXC_PID=%s."
,
pidstr
);
/* Run any host-side start hooks */
/* Run any host-side start hooks */
if
(
run_lxc_hooks
(
name
,
"start-host"
,
conf
,
NULL
))
{
if
(
run_lxc_hooks
(
name
,
"start-host"
,
conf
,
NULL
))
{
ERROR
(
"Failed to run lxc.hook.start-host for container
\"
%s
\"
."
,
name
);
ERROR
(
"Failed to run lxc.hook.start-host for container
\"
%s
\"
."
,
name
);
return
-
1
;
goto
out_delete_net
;
}
}
/* Tell the child to complete its initialization and wait for it to exec
/* Tell the child to complete its initialization and wait for it to exec
...
@@ -1677,7 +1680,7 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1677,7 +1680,7 @@ static int lxc_spawn(struct lxc_handler *handler)
* value, causing us to error out).
* value, causing us to error out).
*/
*/
if
(
lxc_sync_barrier_child
(
handler
,
LXC_SYNC_READY_START
))
if
(
lxc_sync_barrier_child
(
handler
,
LXC_SYNC_READY_START
))
return
-
1
;
goto
out_delete_net
;
if
(
lxc_network_recv_name_and_ifindex_from_child
(
handler
)
<
0
)
{
if
(
lxc_network_recv_name_and_ifindex_from_child
(
handler
)
<
0
)
{
ERROR
(
"Failed to receive names and ifindices for network "
ERROR
(
"Failed to receive names and ifindices for network "
...
...
src/tests/share_ns.c
View file @
ba2861ff
...
@@ -56,7 +56,7 @@ void *ns_sharing_wrapper(void *data)
...
@@ -56,7 +56,7 @@ void *ns_sharing_wrapper(void *data)
c
=
lxc_container_new
(
name
,
NULL
);
c
=
lxc_container_new
(
name
,
NULL
);
if
(
!
c
)
{
if
(
!
c
)
{
lxc_error
(
"Failed to create container
\"
%s
\"\n
"
,
name
);
lxc_error
(
"Failed to create container
\"
%s
\"\n
"
,
name
);
goto
out
;
return
NULL
;
}
}
if
(
c
->
is_defined
(
c
))
{
if
(
c
->
is_defined
(
c
))
{
...
...
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