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
70703881
Unverified
Commit
70703881
authored
Feb 18, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: lxc_check_inherited()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
d2f10912
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
6 deletions
+9
-6
start.c
src/lxc/start.c
+9
-6
No files found.
src/lxc/start.c
View file @
70703881
...
@@ -192,10 +192,10 @@ static int match_fd(int fd)
...
@@ -192,10 +192,10 @@ static int match_fd(int fd)
int
lxc_check_inherited
(
struct
lxc_conf
*
conf
,
bool
closeall
,
int
lxc_check_inherited
(
struct
lxc_conf
*
conf
,
bool
closeall
,
int
*
fds_to_ignore
,
size_t
len_fds
)
int
*
fds_to_ignore
,
size_t
len_fds
)
{
{
struct
dirent
*
direntp
;
int
fd
,
fddir
;
int
fd
,
fddir
;
size_t
i
;
size_t
i
;
DIR
*
dir
;
DIR
*
dir
;
struct
dirent
*
direntp
;
if
(
conf
&&
conf
->
close_all_fds
)
if
(
conf
&&
conf
->
close_all_fds
)
closeall
=
true
;
closeall
=
true
;
...
@@ -203,21 +203,24 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
...
@@ -203,21 +203,24 @@ int lxc_check_inherited(struct lxc_conf *conf, bool closeall,
restart:
restart:
dir
=
opendir
(
"/proc/self/fd"
);
dir
=
opendir
(
"/proc/self/fd"
);
if
(
!
dir
)
{
if
(
!
dir
)
{
WARN
(
"
Failed to open directory: %s.
"
,
strerror
(
errno
));
WARN
(
"
%s - Failed to open directory
"
,
strerror
(
errno
));
return
-
1
;
return
-
1
;
}
}
fddir
=
dirfd
(
dir
);
fddir
=
dirfd
(
dir
);
while
((
direntp
=
readdir
(
dir
)))
{
while
((
direntp
=
readdir
(
dir
)))
{
if
(
!
strcmp
(
direntp
->
d_name
,
"."
))
int
ret
;
if
(
strcmp
(
direntp
->
d_name
,
"."
)
==
0
)
continue
;
continue
;
if
(
!
strcmp
(
direntp
->
d_name
,
".."
)
)
if
(
strcmp
(
direntp
->
d_name
,
".."
)
==
0
)
continue
;
continue
;
if
(
lxc_safe_int
(
direntp
->
d_name
,
&
fd
)
<
0
)
{
ret
=
lxc_safe_int
(
direntp
->
d_name
,
&
fd
);
INFO
(
"Could not parse file descriptor for: %s"
,
direntp
->
d_name
);
if
(
ret
<
0
)
{
INFO
(
"Could not parse file descriptor for
\"
%s
\"
"
,
direntp
->
d_name
);
continue
;
continue
;
}
}
...
...
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