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
6e5fc7a5
Unverified
Commit
6e5fc7a5
authored
Oct 29, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: close non-needed file descriptors
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
4e4832ee
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
start.c
src/lxc/start.c
+10
-1
No files found.
src/lxc/start.c
View file @
6e5fc7a5
...
@@ -1164,16 +1164,17 @@ void resolve_clone_flags(struct lxc_handler *handler)
...
@@ -1164,16 +1164,17 @@ void resolve_clone_flags(struct lxc_handler *handler)
static
int
lxc_spawn
(
struct
lxc_handler
*
handler
)
static
int
lxc_spawn
(
struct
lxc_handler
*
handler
)
{
{
int
i
,
flags
,
ret
;
int
i
,
flags
,
ret
;
const
char
*
name
=
handler
->
name
;
char
pidstr
[
20
];
char
pidstr
[
20
];
bool
wants_to_map_ids
;
bool
wants_to_map_ids
;
int
saved_ns_fd
[
LXC_NS_MAX
];
int
saved_ns_fd
[
LXC_NS_MAX
];
struct
lxc_list
*
id_map
;
struct
lxc_list
*
id_map
;
int
preserve_mask
=
0
;
int
preserve_mask
=
0
;
const
char
*
name
=
handler
->
name
;
bool
cgroups_connected
=
false
;
bool
cgroups_connected
=
false
;
id_map
=
&
handler
->
conf
->
id_map
;
id_map
=
&
handler
->
conf
->
id_map
;
wants_to_map_ids
=
!
lxc_list_empty
(
id_map
);
wants_to_map_ids
=
!
lxc_list_empty
(
id_map
);
memset
(
saved_ns_fd
,
-
1
,
sizeof
(
int
)
*
LXC_NS_MAX
);
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
if
(
handler
->
conf
->
inherit_ns_fd
[
i
]
!=
-
1
)
if
(
handler
->
conf
->
inherit_ns_fd
[
i
]
!=
-
1
)
...
@@ -1410,9 +1411,17 @@ static int lxc_spawn(struct lxc_handler *handler)
...
@@ -1410,9 +1411,17 @@ static int lxc_spawn(struct lxc_handler *handler)
lxc_sync_fini
(
handler
);
lxc_sync_fini
(
handler
);
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
if
(
saved_ns_fd
[
i
]
!=
-
1
)
close
(
saved_ns_fd
[
i
]);
return
0
;
return
0
;
out_delete_net:
out_delete_net:
for
(
i
=
0
;
i
<
LXC_NS_MAX
;
i
++
)
if
(
saved_ns_fd
[
i
]
!=
-
1
)
close
(
saved_ns_fd
[
i
]);
if
(
cgroups_connected
)
if
(
cgroups_connected
)
cgroup_disconnect
();
cgroup_disconnect
();
...
...
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