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
ab92468c
Unverified
Commit
ab92468c
authored
Mar 11, 2020
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commands: simplify lxc_cmd_fd_cleanup()
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
823486c1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
7 deletions
+11
-7
commands.c
src/lxc/commands.c
+11
-7
No files found.
src/lxc/commands.c
View file @
ab92468c
...
@@ -1322,29 +1322,33 @@ static int lxc_cmd_process(int fd, struct lxc_cmd_req *req,
...
@@ -1322,29 +1322,33 @@ static int lxc_cmd_process(int fd, struct lxc_cmd_req *req,
static
void
lxc_cmd_fd_cleanup
(
int
fd
,
struct
lxc_handler
*
handler
,
static
void
lxc_cmd_fd_cleanup
(
int
fd
,
struct
lxc_handler
*
handler
,
struct
lxc_epoll_descr
*
descr
,
const
lxc_cmd_t
cmd
)
struct
lxc_epoll_descr
*
descr
,
const
lxc_cmd_t
cmd
)
{
{
struct
lxc_list
*
cur
,
*
next
;
lxc_terminal_free
(
handler
->
conf
,
fd
);
lxc_terminal_free
(
handler
->
conf
,
fd
);
lxc_mainloop_del_handler
(
descr
,
fd
);
lxc_mainloop_del_handler
(
descr
,
fd
);
if
(
cmd
==
LXC_CMD_ADD_STATE_CLIENT
)
{
if
(
cmd
==
LXC_CMD_ADD_STATE_CLIENT
)
{
struct
lxc_list
*
cur
,
*
next
;
lxc_list_for_each_safe
(
cur
,
&
handler
->
conf
->
state_clients
,
next
)
{
lxc_list_for_each_safe
(
cur
,
&
handler
->
conf
->
state_clients
,
next
)
{
struct
lxc_state_client
*
client
=
cur
->
elem
;
struct
lxc_state_client
*
client
=
cur
->
elem
;
if
(
client
->
clientfd
!=
fd
)
if
(
client
->
clientfd
!=
fd
)
continue
;
continue
;
/* kick client from list */
/*
* Only kick client from list so it can't be found
* anymore. The actual close happens, as for all other
* file descriptors, below.
*/
lxc_list_del
(
cur
);
lxc_list_del
(
cur
);
close
(
client
->
clientfd
);
free
(
cur
->
elem
);
free
(
cur
->
elem
);
free
(
cur
);
free
(
cur
);
/*
/*
* No need to walk the whole list. If we found the state
* No need to walk the whole list. If we found the state
* client fd there can't be a second one.
* client fd there can't be a second one.
*/
*/
TRACE
(
"
Closed state client fd %d
\n
"
,
fd
);
TRACE
(
"
Found state client fd %d in state client list
"
,
fd
);
return
;
break
;
}
}
/*
/*
...
@@ -1353,7 +1357,7 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
...
@@ -1353,7 +1357,7 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
* was already reached by the time we were ready to add it. So
* was already reached by the time we were ready to add it. So
* fallthrough and clean it up.
* fallthrough and clean it up.
*/
*/
TRACE
(
"Closing state client fd %d
not present in state client list
\n
"
,
fd
);
TRACE
(
"Closing state client fd %d"
,
fd
);
}
}
close
(
fd
);
close
(
fd
);
...
...
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