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
c2250e75
Unverified
Commit
c2250e75
authored
Mar 10, 2020
by
Stéphane Graber
Committed by
GitHub
Mar 10, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3285 from brauner/2020-03-10/fixes
bugfixes
parents
bf7e2093
39e2a438
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
commands.c
src/lxc/commands.c
+14
-12
macro.h
src/lxc/macro.h
+2
-2
No files found.
src/lxc/commands.c
View file @
c2250e75
...
...
@@ -329,13 +329,13 @@ int lxc_try_cmd(const char *name, const char *lxcpath)
pid_t
lxc_cmd_get_init_pid
(
const
char
*
name
,
const
char
*
lxcpath
)
{
int
ret
,
stopped
;
intmax
_t
pid
=
-
1
;
pid
_t
pid
=
-
1
;
struct
lxc_cmd_rr
cmd
=
{
.
req
=
{
.
cmd
=
LXC_CMD_GET_INIT_PID
},
.
rsp
=
{
.
data
=
INTMAX
_TO_PTR
(
pid
)
.
data
=
PID
_TO_PTR
(
pid
)
}
};
...
...
@@ -343,7 +343,7 @@ pid_t lxc_cmd_get_init_pid(const char *name, const char *lxcpath)
if
(
ret
<
0
)
return
-
1
;
pid
=
PTR_TO_
INTMAX
(
cmd
.
rsp
.
data
);
pid
=
PTR_TO_
PID
(
cmd
.
rsp
.
data
);
if
(
pid
<
0
)
return
-
1
;
...
...
@@ -357,10 +357,8 @@ static int lxc_cmd_get_init_pid_callback(int fd, struct lxc_cmd_req *req,
struct
lxc_handler
*
handler
,
struct
lxc_epoll_descr
*
descr
)
{
intmax_t
pid
=
handler
->
pid
;
struct
lxc_cmd_rsp
rsp
=
{
.
data
=
INTMAX_TO_PTR
(
pid
)
.
data
=
PID_TO_PTR
(
handler
->
pid
)
};
return
lxc_cmd_rsp_send
(
fd
,
&
rsp
);
...
...
@@ -875,10 +873,6 @@ static int lxc_cmd_add_state_client_callback(__owns int fd, struct lxc_cmd_req *
if
(
ret
<
0
)
goto
reap_client_fd
;
/* close fd if state is already achieved to avoid leakage */
if
(
rsp
.
ret
!=
MAX_STATE
)
close
(
fd
);
return
0
;
reap_client_fd:
...
...
@@ -1346,12 +1340,20 @@ static void lxc_cmd_fd_cleanup(int fd, struct lxc_handler *handler,
close
(
client
->
clientfd
);
free
(
cur
->
elem
);
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.
*/
break
;
}
break
;
/*
* We didn't add the state client to the list. Either because
* we failed to allocate memory (unlikely) or because the state
* was already reached by the time we were ready to add it. So
* fallthrough and clean it up.
*/
__fallthrough
;
default:
close
(
fd
);
}
...
...
src/lxc/macro.h
View file @
c2250e75
...
...
@@ -414,8 +414,8 @@ enum {
#define PTR_TO_INT(p) ((int)((intptr_t)(p)))
#define INT_TO_PTR(u) ((void *)((intptr_t)(u)))
#define PTR_TO_
INTMAX(p) ((intmax
_t)((intptr_t)(p)))
#define
INTMAX
_TO_PTR(u) ((void *)((intptr_t)(u)))
#define PTR_TO_
PID(p) ((pid
_t)((intptr_t)(p)))
#define
PID
_TO_PTR(u) ((void *)((intptr_t)(u)))
#define PTR_TO_UINT64(p) ((uint64_t)((intptr_t)(p)))
...
...
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