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
52ac245b
Unverified
Commit
52ac245b
authored
Jun 16, 2019
by
Christian Brauner
Committed by
GitHub
Jun 16, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3047 from Rachid-Koucha/patch-11
Fixed file descriptor leak for network namespace
parents
3d43f611
aa0c0e7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
start.c
src/lxc/start.c
+16
-15
No files found.
src/lxc/start.c
View file @
52ac245b
...
...
@@ -1826,23 +1826,24 @@ static int lxc_spawn(struct lxc_handler *handler)
if
(
!
cgroup_ops
->
chown
(
cgroup_ops
,
handler
->
conf
))
goto
out_delete_net
;
/* Now we're ready to preserve the network namespace */
ret
=
lxc_try_preserve_ns
(
handler
->
pid
,
"net"
);
if
(
ret
<
0
)
{
if
(
ret
!=
-
EOPNOTSUPP
)
{
SYSERROR
(
"Failed to preserve net namespace"
);
goto
out_delete_net
;
/* If not done yet, we're now ready to preserve the network namespace */
if
(
handler
->
nsfd
[
LXC_NS_NET
]
<
0
)
{
ret
=
lxc_try_preserve_ns
(
handler
->
pid
,
"net"
);
if
(
ret
<
0
)
{
if
(
ret
!=
-
EOPNOTSUPP
)
{
SYSERROR
(
"Failed to preserve net namespace"
);
goto
out_delete_net
;
}
}
else
{
handler
->
nsfd
[
LXC_NS_NET
]
=
ret
;
DEBUG
(
"Preserved net namespace via fd %d"
,
ret
);
}
}
else
{
handler
->
nsfd
[
LXC_NS_NET
]
=
ret
;
DEBUG
(
"Preserved net namespace via fd %d"
,
ret
);
ret
=
lxc_netns_set_nsid
(
handler
->
nsfd
[
LXC_NS_NET
]);
if
(
ret
<
0
)
SYSWARN
(
"Failed to allocate new network namespace id"
);
else
TRACE
(
"Allocated new network namespace id"
);
}
ret
=
lxc_netns_set_nsid
(
handler
->
nsfd
[
LXC_NS_NET
]);
if
(
ret
<
0
)
SYSWARN
(
"Failed to allocate new network namespace id"
);
else
TRACE
(
"Allocated new network namespace id"
);
/* Create the network configuration. */
if
(
handler
->
ns_clone_flags
&
CLONE_NEWNET
)
{
...
...
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