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
4cb8ca34
Unverified
Commit
4cb8ca34
authored
Aug 16, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxccontainer: minor fixes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
cf5792ba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
15 deletions
+18
-15
lxccontainer.c
src/lxc/lxccontainer.c
+18
-15
No files found.
src/lxc/lxccontainer.c
View file @
4cb8ca34
...
@@ -949,10 +949,15 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -949,10 +949,15 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
/* We don't really care if this doesn't print all the
/* We don't really care if this doesn't print all the
* characters. All that it means is that the proctitle will be
* characters. All that it means is that the proctitle will be
* ugly. Similarly, we also don't care if setproctitle() fails.
* ugly. Similarly, we also don't care if setproctitle() fails.
* */
*/
(
void
)
snprintf
(
title
,
sizeof
(
title
),
"[lxc monitor] %s %s"
,
c
->
config_path
,
c
->
name
);
ret
=
snprintf
(
title
,
sizeof
(
title
),
"[lxc monitor] %s %s"
,
c
->
config_path
,
c
->
name
);
INFO
(
"Attempting to set proc title to %s"
,
title
);
if
(
ret
>
0
)
{
(
void
)
setproctitle
(
title
);
ret
=
setproctitle
(
title
);
if
(
ret
<
0
)
INFO
(
"Failed to set process title to %s"
,
title
);
else
INFO
(
"Set process title to %s"
,
title
);
}
/* We fork() a second time to be reparented to init. Like
/* We fork() a second time to be reparented to init. Like
* POSIX's daemon() function we change to "/" and redirect
* POSIX's daemon() function we change to "/" and redirect
...
@@ -999,17 +1004,15 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -999,17 +1004,15 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
ret
=
setsid
();
ret
=
setsid
();
if
(
ret
<
0
)
if
(
ret
<
0
)
TRACE
(
"Process %d is already process group leader"
,
lxc_raw_getpid
());
TRACE
(
"Process %d is already process group leader"
,
lxc_raw_getpid
());
}
else
{
}
else
if
(
!
am_single_threaded
())
{
if
(
!
am_single_threaded
())
{
ERROR
(
"Cannot start non-daemonized container when threaded"
);
ERROR
(
"Cannot start non-daemonized container when threaded"
);
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
lxc_free_handler
(
handler
);
return
false
;
return
false
;
}
}
}
/* We need to write PID file after daemonize, so we always
/* We need to write PID file after daemonize, so we always
write the
*
write the
right PID.
* right PID.
*/
*/
if
(
c
->
pidfile
)
{
if
(
c
->
pidfile
)
{
int
ret
,
w
;
int
ret
,
w
;
...
@@ -1033,7 +1036,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1033,7 +1036,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
free_init_cmd
(
init_cmd
);
free_init_cmd
(
init_cmd
);
lxc_free_handler
(
handler
);
lxc_free_handler
(
handler
);
SYSERROR
(
"Failed to write
'%s'
"
,
c
->
pidfile
);
SYSERROR
(
"Failed to write
monitor pid to
\"
%s
\"
"
,
c
->
pidfile
);
if
(
c
->
daemonize
)
if
(
c
->
daemonize
)
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
...
@@ -1048,7 +1051,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
...
@@ -1048,7 +1051,7 @@ static bool do_lxcapi_start(struct lxc_container *c, int useinit, char * const a
if
(
conf
->
monitor_unshare
)
{
if
(
conf
->
monitor_unshare
)
{
ret
=
unshare
(
CLONE_NEWNS
);
ret
=
unshare
(
CLONE_NEWNS
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
SYSERROR
(
"
f
ailed to unshare mount namespace"
);
SYSERROR
(
"
F
ailed to unshare mount namespace"
);
lxc_free_handler
(
handler
);
lxc_free_handler
(
handler
);
ret
=
1
;
ret
=
1
;
goto
on_error
;
goto
on_error
;
...
...
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