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
fbf93af1
Unverified
Commit
fbf93af1
authored
May 24, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utils: fix task_blocking_signal()
sscanf() skips whitespace anyway so don't account for tabs in case the file layout changes. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
dfd1d017
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
lxccontainer.c
src/lxc/lxccontainer.c
+2
-3
utils.c
src/lxc/utils.c
+8
-9
No files found.
src/lxc/lxccontainer.c
View file @
fbf93af1
...
...
@@ -1829,11 +1829,10 @@ static bool do_lxcapi_shutdown(struct lxc_container *c, int timeout)
return
true
;
/* Detect whether we should send SIGRTMIN + 3 (e.g. systemd). */
if
(
task_blocking_signal
(
pid
,
(
SIGRTMIN
+
3
)))
haltsignal
=
(
SIGRTMIN
+
3
);
if
(
c
->
lxc_conf
&&
c
->
lxc_conf
->
haltsignal
)
haltsignal
=
c
->
lxc_conf
->
haltsignal
;
else
if
(
task_blocking_signal
(
pid
,
(
SIGRTMIN
+
3
)))
haltsignal
=
(
SIGRTMIN
+
3
);
/* Add a new state client before sending the shutdown signal so that we
* don't miss a state.
...
...
src/lxc/utils.c
View file @
fbf93af1
...
...
@@ -1769,17 +1769,16 @@ int lxc_strmunmap(void *addr, size_t length)
/* Check whether a signal is blocked by a process. */
/* /proc/pid-to-str/status\0 = (5 + 21 + 7 + 1) */
#define __PROC_STATUS_LEN (
5
+ (LXC_NUMSTRLEN64) + 7 + 1)
#define __PROC_STATUS_LEN (
6
+ (LXC_NUMSTRLEN64) + 7 + 1)
bool
task_blocking_signal
(
pid_t
pid
,
int
signal
)
{
bool
bret
=
false
;
char
*
line
=
NULL
;
long
unsigned
int
sigblk
=
0
;
size_t
n
=
0
;
int
ret
;
FILE
*
f
;
char
status
[
__PROC_STATUS_LEN
];
FILE
*
f
;
long
unsigned
int
sigblk
=
0
;
size_t
n
=
0
;
bool
bret
=
false
;
char
*
line
=
NULL
;
ret
=
snprintf
(
status
,
__PROC_STATUS_LEN
,
"/proc/%d/status"
,
pid
);
if
(
ret
<
0
||
ret
>=
__PROC_STATUS_LEN
)
...
...
@@ -1790,10 +1789,10 @@ bool task_blocking_signal(pid_t pid, int signal)
return
bret
;
while
(
getline
(
&
line
,
&
n
,
f
)
!=
-
1
)
{
if
(
strncmp
(
line
,
"SigBlk:
\t
"
,
8
))
if
(
strncmp
(
line
,
"SigBlk:
"
,
7
))
continue
;
if
(
sscanf
(
line
+
8
,
"%lx"
,
&
sigblk
)
!=
1
)
if
(
sscanf
(
line
+
7
,
"%lx"
,
&
sigblk
)
!=
1
)
goto
out
;
}
...
...
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