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
9443e2e9
Unverified
Commit
9443e2e9
authored
Oct 23, 2018
by
2xsec
Committed by
Christian Brauner
Nov 22, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dlog: inherit dlog fds
Signed-off-by:
2xsec
<
dh48.jeong@samsung.com
>
parent
78046c46
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
start.c
src/lxc/start.c
+37
-0
No files found.
src/lxc/start.c
View file @
9443e2e9
...
...
@@ -204,6 +204,38 @@ static inline bool match_stdfds(int fd)
return
(
fd
==
STDIN_FILENO
||
fd
==
STDOUT_FILENO
||
fd
==
STDERR_FILENO
);
}
#ifdef HAVE_DLOG
static
bool
match_dlog_fds
(
struct
dirent
*
direntp
)
{
char
path
[
PATH_MAX
]
=
{
0
};
char
link
[
PATH_MAX
]
=
{
0
};
ssize_t
linklen
;
int
ret
;
ret
=
snprintf
(
path
,
PATH_MAX
,
"/proc/self/fd/%s"
,
direntp
->
d_name
);
if
(
ret
<
0
||
ret
>=
PATH_MAX
)
{
ERROR
(
"Failed to create file descriptor name"
);
return
false
;
}
linklen
=
readlink
(
path
,
link
,
PATH_MAX
);
if
(
linklen
<
0
)
{
SYSERROR
(
"Failed to read link path -
\"
%s
\"
"
,
path
);
return
false
;
}
else
if
(
linklen
>=
PATH_MAX
)
{
ERROR
(
"The name of link path is too long -
\"
%s
\"
"
,
path
);
return
false
;
}
if
(
strcmp
(
link
,
"/dev/log_main"
)
==
0
||
strcmp
(
link
,
"/dev/log_system"
)
==
0
||
strcmp
(
link
,
"/dev/log_radio"
)
==
0
)
return
true
;
return
false
;
}
#endif
int
lxc_check_inherited
(
struct
lxc_conf
*
conf
,
bool
closeall
,
int
*
fds_to_ignore
,
size_t
len_fds
)
{
...
...
@@ -265,6 +297,11 @@ restart:
if
(
matched
)
continue
;
#ifdef HAVE_DLOG
if
(
match_dlog_fds
(
direntp
))
continue
;
#endif
if
(
current_config
&&
fd
==
current_config
->
logfd
)
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