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
9ad66589
Unverified
Commit
9ad66589
authored
Mar 15, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start: better goto target naming in __lxc_start()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
65a2dc8b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
start.c
src/lxc/start.c
+19
-20
No files found.
src/lxc/start.c
View file @
9ad66589
...
@@ -1889,7 +1889,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1889,7 +1889,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret
=
lxc_init
(
name
,
handler
);
ret
=
lxc_init
(
name
,
handler
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to initialize container
\"
%s
\"
"
,
name
);
ERROR
(
"Failed to initialize container
\"
%s
\"
"
,
name
);
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
handler
->
ops
=
ops
;
handler
->
ops
=
ops
;
handler
->
data
=
data
;
handler
->
data
=
data
;
...
@@ -1899,25 +1899,25 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1899,25 +1899,25 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
if
(
!
attach_block_device
(
handler
->
conf
))
{
if
(
!
attach_block_device
(
handler
->
conf
))
{
ERROR
(
"Failed to attach block device"
);
ERROR
(
"Failed to attach block device"
);
ret
=
-
1
;
ret
=
-
1
;
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
if
(
!
cgroup_ops
->
monitor_create
(
cgroup_ops
,
handler
))
{
if
(
!
cgroup_ops
->
monitor_create
(
cgroup_ops
,
handler
))
{
ERROR
(
"Failed to create monitor cgroup"
);
ERROR
(
"Failed to create monitor cgroup"
);
ret
=
-
1
;
ret
=
-
1
;
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
if
(
!
cgroup_ops
->
monitor_enter
(
cgroup_ops
,
handler
))
{
if
(
!
cgroup_ops
->
monitor_enter
(
cgroup_ops
,
handler
))
{
ERROR
(
"Failed to enter monitor cgroup"
);
ERROR
(
"Failed to enter monitor cgroup"
);
ret
=
-
1
;
ret
=
-
1
;
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
if
(
!
cgroup_ops
->
monitor_delegate_controllers
(
cgroup_ops
))
{
if
(
!
cgroup_ops
->
monitor_delegate_controllers
(
cgroup_ops
))
{
ERROR
(
"Failed to delegate controllers to monitor cgroup"
);
ERROR
(
"Failed to delegate controllers to monitor cgroup"
);
ret
=
-
1
;
ret
=
-
1
;
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
if
(
geteuid
()
==
0
&&
!
lxc_list_empty
(
&
conf
->
id_map
))
{
if
(
geteuid
()
==
0
&&
!
lxc_list_empty
(
&
conf
->
id_map
))
{
...
@@ -1926,7 +1926,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1926,7 +1926,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret
=
unshare
(
CLONE_NEWNS
);
ret
=
unshare
(
CLONE_NEWNS
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Failed to unshare CLONE_NEWNS"
);
ERROR
(
"Failed to unshare CLONE_NEWNS"
);
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
INFO
(
"Unshared CLONE_NEWNS"
);
INFO
(
"Unshared CLONE_NEWNS"
);
...
@@ -1934,7 +1934,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1934,7 +1934,7 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret
=
lxc_setup_rootfs_prepare_root
(
conf
,
name
,
lxcpath
);
ret
=
lxc_setup_rootfs_prepare_root
(
conf
,
name
,
lxcpath
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"Error setting up rootfs mount as root before spawn"
);
ERROR
(
"Error setting up rootfs mount as root before spawn"
);
goto
out_
fini_none
t
;
goto
out_
abor
t
;
}
}
INFO
(
"Set up container rootfs as host root"
);
INFO
(
"Set up container rootfs as host root"
);
}
}
...
@@ -1951,13 +1951,13 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1951,13 +1951,13 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
ret
=
lxc_poll
(
name
,
handler
);
ret
=
lxc_poll
(
name
,
handler
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"LXC mainloop exited with error: %d"
,
ret
);
ERROR
(
"LXC mainloop exited with error: %d"
,
ret
);
goto
out_
abort
;
goto
out_
delete_network
;
}
}
if
(
!
handler
->
init_died
&&
handler
->
pid
>
0
)
{
if
(
!
handler
->
init_died
&&
handler
->
pid
>
0
)
{
ERROR
(
"Child process is not killed"
);
ERROR
(
"Child process is not killed"
);
ret
=
-
1
;
ret
=
-
1
;
goto
out_
abort
;
goto
out_
delete_network
;
}
}
status
=
lxc_wait_for_pid_status
(
handler
->
pid
);
status
=
lxc_wait_for_pid_status
(
handler
->
pid
);
...
@@ -1997,31 +1997,30 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
...
@@ -1997,31 +1997,30 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
if
(
error_num
)
if
(
error_num
)
*
error_num
=
handler
->
exit_status
;
*
error_num
=
handler
->
exit_status
;
/* These are
the goto targets you are not allowed to jump to
. */
/* These are
not the droids you are looking for
. */
__
out_fini
:
__
private_goto1
:
lxc_delete_network
(
handler
);
lxc_delete_network
(
handler
);
__
out_detach_blockdev
:
__
private_goto2
:
detach_block_device
(
handler
->
conf
);
detach_block_device
(
handler
->
conf
);
__
out_fini_nonet
:
__
private_goto3
:
lxc_fini
(
name
,
handler
);
lxc_fini
(
name
,
handler
);
return
ret
;
return
ret
;
/* These are the
goto targets you want to jump to
. */
/* These are the
droids you are looking for
. */
out_
fini_none
t:
out_
abor
t:
lxc_abort
(
name
,
handler
);
lxc_abort
(
name
,
handler
);
goto
__
out_fini_nonet
;
goto
__
private_goto3
;
out_detach_blockdev:
out_detach_blockdev:
lxc_abort
(
name
,
handler
);
lxc_abort
(
name
,
handler
);
goto
__
out_detach_blockdev
;
goto
__
private_goto2
;
out_
abort
:
out_
delete_network
:
lxc_abort
(
name
,
handler
);
lxc_abort
(
name
,
handler
);
goto
__out_fini
;
goto
__private_goto1
;
}
}
struct
start_args
{
struct
start_args
{
...
...
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