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
b6d5de95
Unverified
Commit
b6d5de95
authored
Feb 28, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
terminal: error out when SIGTERM cannot be added
This should be an error condition. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
e62912bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
5 deletions
+18
-5
terminal.c
src/lxc/terminal.c
+18
-5
No files found.
src/lxc/terminal.c
View file @
b6d5de95
...
...
@@ -133,7 +133,7 @@ int lxc_terminal_signalfd_cb(int fd, uint32_t events, void *cbdata,
struct
lxc_terminal_state
*
lxc_terminal_signal_init
(
int
srcfd
,
int
dstfd
)
{
int
ret
;
bool
istty
;
bool
istty
=
false
;
sigset_t
mask
;
struct
lxc_terminal_state
*
ts
;
...
...
@@ -146,20 +146,31 @@ struct lxc_terminal_state *lxc_terminal_signal_init(int srcfd, int dstfd)
ts
->
masterfd
=
dstfd
;
ts
->
sigfd
=
-
1
;
sigemptyset
(
&
mask
);
ret
=
sigemptyset
(
&
mask
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to initialize an empty signal set"
);
goto
on_error
;
}
istty
=
isatty
(
srcfd
)
==
1
;
istty
=
(
isatty
(
srcfd
)
==
1
)
;
if
(
!
istty
)
{
INFO
(
"fd %d does not refer to a tty device"
,
srcfd
);
}
else
{
/* Add tty to list to be scanned at SIGWINCH time. */
lxc_list_add_elem
(
&
ts
->
node
,
ts
);
lxc_list_add_tail
(
&
lxc_ttys
,
&
ts
->
node
);
sigaddset
(
&
mask
,
SIGWINCH
);
ret
=
sigaddset
(
&
mask
,
SIGWINCH
);
if
(
ret
<
0
)
NOTICE
(
"%s - Failed to add SIGWINCH to signal set"
,
strerror
(
errno
));
}
/* Exit the mainloop cleanly on SIGTERM. */
sigaddset
(
&
mask
,
SIGTERM
);
ret
=
sigaddset
(
&
mask
,
SIGTERM
);
if
(
ret
<
0
)
{
SYSERROR
(
"Failed to add SIGWINCH to signal set"
);
goto
on_error
;
}
ret
=
sigprocmask
(
SIG_BLOCK
,
&
mask
,
&
ts
->
oldmask
);
if
(
ret
<
0
)
{
...
...
@@ -183,8 +194,10 @@ on_error:
close
(
ts
->
sigfd
);
ts
->
sigfd
=
-
1
;
}
if
(
istty
)
lxc_list_del
(
&
ts
->
node
);
return
ts
;
}
...
...
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