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
c7d64498
Unverified
Commit
c7d64498
authored
Feb 01, 2021
by
Stéphane Graber
Committed by
GitHub
Feb 01, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3645 from brauner/2021-02-01/fixes_4
attach: bugfixes
parents
32947602
4ac35afb
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
19 deletions
+14
-19
attach.c
src/lxc/attach.c
+4
-3
commands_utils.c
src/lxc/commands_utils.c
+5
-6
conf.c
src/lxc/conf.c
+4
-8
confile_utils.c
src/lxc/confile_utils.c
+1
-2
No files found.
src/lxc/attach.c
View file @
c7d64498
...
@@ -1190,8 +1190,6 @@ __noreturn static void do_attach(struct attach_payload *ap)
...
@@ -1190,8 +1190,6 @@ __noreturn static void do_attach(struct attach_payload *ap)
TRACE
(
"Prepared terminal file descriptor %d"
,
ap
->
terminal_pts_fd
);
TRACE
(
"Prepared terminal file descriptor %d"
,
ap
->
terminal_pts_fd
);
}
}
put_attach_payload
(
ap
);
/* Avoid unnecessary syscalls. */
/* Avoid unnecessary syscalls. */
if
(
ctx
->
setup_ns_uid
==
ctx
->
target_ns_uid
)
if
(
ctx
->
setup_ns_uid
==
ctx
->
target_ns_uid
)
ctx
->
target_ns_uid
=
LXC_INVALID_UID
;
ctx
->
target_ns_uid
=
LXC_INVALID_UID
;
...
@@ -1210,11 +1208,14 @@ __noreturn static void do_attach(struct attach_payload *ap)
...
@@ -1210,11 +1208,14 @@ __noreturn static void do_attach(struct attach_payload *ap)
if
(
!
lxc_switch_uid_gid
(
ctx
->
target_ns_uid
,
ctx
->
target_ns_gid
))
if
(
!
lxc_switch_uid_gid
(
ctx
->
target_ns_uid
,
ctx
->
target_ns_gid
))
goto
on_error
;
goto
on_error
;
put_attach_payload
(
ap
);
/* We're done, so we can now do whatever the user intended us to do. */
/* We're done, so we can now do whatever the user intended us to do. */
_exit
(
attach_function
(
attach_function_args
));
_exit
(
attach_function
(
attach_function_args
));
on_error:
on_error:
ERROR
(
"Failed to attach to container"
);
ERROR
(
"Failed to attach to container"
);
put_attach_payload
(
ap
);
_exit
(
EXIT_FAILURE
);
_exit
(
EXIT_FAILURE
);
}
}
...
@@ -1320,7 +1321,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
...
@@ -1320,7 +1321,7 @@ int lxc_attach(struct lxc_container *container, lxc_attach_exec_t exec_function,
ret
=
get_attach_context_nsfds
(
ctx
,
options
);
ret
=
get_attach_context_nsfds
(
ctx
,
options
);
if
(
ret
)
{
if
(
ret
)
{
lxc_container_put
(
container
);
put_attach_context
(
ctx
);
return
log_error
(
-
1
,
"Failed to get namespace file descriptors"
);
return
log_error
(
-
1
,
"Failed to get namespace file descriptors"
);
}
}
...
...
src/lxc/commands_utils.c
View file @
c7d64498
...
@@ -166,7 +166,7 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler,
...
@@ -166,7 +166,7 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler,
__do_free
struct
lxc_list
*
tmplist
=
NULL
;
__do_free
struct
lxc_list
*
tmplist
=
NULL
;
int
state
;
int
state
;
newclient
=
m
alloc
(
sizeof
(
*
newclient
));
newclient
=
z
alloc
(
sizeof
(
*
newclient
));
if
(
!
newclient
)
if
(
!
newclient
)
return
-
ENOMEM
;
return
-
ENOMEM
;
...
@@ -174,20 +174,19 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler,
...
@@ -174,20 +174,19 @@ int lxc_add_state_client(int state_client_fd, struct lxc_handler *handler,
memcpy
(
newclient
->
states
,
states
,
sizeof
(
newclient
->
states
));
memcpy
(
newclient
->
states
,
states
,
sizeof
(
newclient
->
states
));
newclient
->
clientfd
=
state_client_fd
;
newclient
->
clientfd
=
state_client_fd
;
tmplist
=
m
alloc
(
sizeof
(
*
tmplist
));
tmplist
=
z
alloc
(
sizeof
(
*
tmplist
));
if
(
!
tmplist
)
if
(
!
tmplist
)
return
-
ENOMEM
;
return
-
ENOMEM
;
state
=
handler
->
state
;
state
=
handler
->
state
;
if
(
states
[
state
]
!=
1
)
{
if
(
states
[
state
]
!=
1
)
{
lxc_list_add_elem
(
tmplist
,
newclient
);
lxc_list_add_elem
(
tmplist
,
move_ptr
(
newclient
)
);
lxc_list_add_tail
(
&
handler
->
conf
->
state_clients
,
tmplist
);
lxc_list_add_tail
(
&
handler
->
conf
->
state_clients
,
move_ptr
(
tmplist
)
);
}
else
{
}
else
{
TRACE
(
"Container already in requested state"
);
return
state
;
return
state
;
}
}
move_ptr
(
newclient
);
move_ptr
(
tmplist
);
TRACE
(
"Added state client fd %d to state client list"
,
state_client_fd
);
TRACE
(
"Added state client fd %d to state client list"
,
state_client_fd
);
return
MAX_STATE
;
return
MAX_STATE
;
}
}
src/lxc/conf.c
View file @
c7d64498
...
@@ -4112,8 +4112,7 @@ int userns_exec_1(const struct lxc_conf *conf, int (*fn)(void *), void *data,
...
@@ -4112,8 +4112,7 @@ int userns_exec_1(const struct lxc_conf *conf, int (*fn)(void *), void *data,
close_prot_errno_disarm
(
pipe_fds
[
0
]);
close_prot_errno_disarm
(
pipe_fds
[
0
]);
if
(
lxc_log_get_level
()
==
LXC_LOG_LEVEL_TRACE
||
if
(
lxc_log_trace
())
{
conf
->
loglevel
==
LXC_LOG_LEVEL_TRACE
)
{
struct
id_map
*
map
;
struct
id_map
*
map
;
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
...
@@ -4227,8 +4226,7 @@ int userns_exec_minimal(const struct lxc_conf *conf,
...
@@ -4227,8 +4226,7 @@ int userns_exec_minimal(const struct lxc_conf *conf,
close_prot_errno_disarm
(
sock_fds
[
0
]);
close_prot_errno_disarm
(
sock_fds
[
0
]);
if
(
lxc_log_get_level
()
==
LXC_LOG_LEVEL_TRACE
||
if
(
lxc_log_trace
())
{
conf
->
loglevel
==
LXC_LOG_LEVEL_TRACE
)
{
struct
id_map
*
map
;
struct
id_map
*
map
;
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
...
@@ -4412,8 +4410,7 @@ int userns_exec_full(struct lxc_conf *conf, int (*fn)(void *), void *data,
...
@@ -4412,8 +4410,7 @@ int userns_exec_full(struct lxc_conf *conf, int (*fn)(void *), void *data,
/* idmap will now keep track of that memory. */
/* idmap will now keep track of that memory. */
host_gid_map
=
NULL
;
host_gid_map
=
NULL
;
if
(
lxc_log_get_level
()
==
LXC_LOG_LEVEL_TRACE
||
if
(
lxc_log_trace
())
{
conf
->
loglevel
==
LXC_LOG_LEVEL_TRACE
)
{
lxc_list_for_each
(
cur
,
idmap
)
{
lxc_list_for_each
(
cur
,
idmap
)
{
map
=
cur
->
elem
;
map
=
cur
->
elem
;
TRACE
(
"establishing %cid mapping for
\"
%d
\"
in new "
TRACE
(
"establishing %cid mapping for
\"
%d
\"
in new "
...
@@ -4634,8 +4631,7 @@ int userns_exec_mapped_root(const char *path, int path_fd,
...
@@ -4634,8 +4631,7 @@ int userns_exec_mapped_root(const char *path, int path_fd,
close_prot_errno_disarm
(
sock_fds
[
0
]);
close_prot_errno_disarm
(
sock_fds
[
0
]);
if
(
lxc_log_get_level
()
==
LXC_LOG_LEVEL_TRACE
||
if
(
lxc_log_trace
())
{
conf
->
loglevel
==
LXC_LOG_LEVEL_TRACE
)
{
struct
id_map
*
map
;
struct
id_map
*
map
;
struct
lxc_list
*
it
;
struct
lxc_list
*
it
;
...
...
src/lxc/confile_utils.c
View file @
c7d64498
...
@@ -225,8 +225,7 @@ void lxc_log_configured_netdevs(const struct lxc_conf *conf)
...
@@ -225,8 +225,7 @@ void lxc_log_configured_netdevs(const struct lxc_conf *conf)
struct
lxc_netdev
*
netdev
;
struct
lxc_netdev
*
netdev
;
struct
lxc_list
*
it
=
(
struct
lxc_list
*
)
&
conf
->
network
;;
struct
lxc_list
*
it
=
(
struct
lxc_list
*
)
&
conf
->
network
;;
if
((
conf
->
loglevel
!=
LXC_LOG_LEVEL_TRACE
)
&&
if
(
!
lxc_log_trace
())
(
lxc_log_get_level
()
!=
LXC_LOG_LEVEL_TRACE
))
return
;
return
;
if
(
lxc_list_empty
(
it
))
{
if
(
lxc_list_empty
(
it
))
{
...
...
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