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
27807cc8
Unverified
Commit
27807cc8
authored
May 20, 2017
by
Li Feng
Committed by
Christian Brauner
Nov 29, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DO NOT add the handles of adjust winsize when the 'stdin' is not a tty
Signed-off-by:
Li Feng
<
lifeng68@huawei.com
>
parent
797bcba3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
16 deletions
+26
-16
console.c
src/lxc/console.c
+26
-16
No files found.
src/lxc/console.c
View file @
27807cc8
...
@@ -121,6 +121,11 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
...
@@ -121,6 +121,11 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
ts
->
masterfd
=
dstfd
;
ts
->
masterfd
=
dstfd
;
ts
->
sigfd
=
-
1
;
ts
->
sigfd
=
-
1
;
if
(
!
isatty
(
srcfd
))
{
INFO
(
"fd %d does not refer to a tty device"
,
srcfd
);
return
ts
;
}
/* add tty to list to be scanned at SIGWINCH time */
/* add tty to list to be scanned at SIGWINCH time */
lxc_list_add_elem
(
&
ts
->
node
,
ts
);
lxc_list_add_elem
(
&
ts
->
node
,
ts
);
lxc_list_add_tail
(
&
lxc_ttys
,
&
ts
->
node
);
lxc_list_add_tail
(
&
lxc_ttys
,
&
ts
->
node
);
...
@@ -128,20 +133,20 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
...
@@ -128,20 +133,20 @@ struct lxc_tty_state *lxc_console_sigwinch_init(int srcfd, int dstfd)
sigemptyset
(
&
mask
);
sigemptyset
(
&
mask
);
sigaddset
(
&
mask
,
SIGWINCH
);
sigaddset
(
&
mask
,
SIGWINCH
);
if
(
sigprocmask
(
SIG_BLOCK
,
&
mask
,
&
ts
->
oldmask
))
{
if
(
sigprocmask
(
SIG_BLOCK
,
&
mask
,
&
ts
->
oldmask
))
{
SYSERROR
(
"failed to block SIGWINCH
.
"
);
SYSERROR
(
"failed to block SIGWINCH"
);
ts
->
sigfd
=
-
1
;
ts
->
sigfd
=
-
1
;
return
ts
;
return
ts
;
}
}
ts
->
sigfd
=
signalfd
(
-
1
,
&
mask
,
0
);
ts
->
sigfd
=
signalfd
(
-
1
,
&
mask
,
0
);
if
(
ts
->
sigfd
<
0
)
{
if
(
ts
->
sigfd
<
0
)
{
SYSERROR
(
"failed to
get signalfd.
"
);
SYSERROR
(
"failed to
create signal fd
"
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
sigprocmask
(
SIG_SETMASK
,
&
ts
->
oldmask
,
NULL
);
ts
->
sigfd
=
-
1
;
ts
->
sigfd
=
-
1
;
return
ts
;
return
ts
;
}
}
DEBUG
(
"
%d got SIGWINCH fd %d
"
,
getpid
(),
ts
->
sigfd
);
DEBUG
(
"
process %d created signal fd %d to handle SIGWINCH events
"
,
getpid
(),
ts
->
sigfd
);
return
ts
;
return
ts
;
}
}
...
@@ -656,16 +661,17 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -656,16 +661,17 @@ int lxc_console(struct lxc_container *c, int ttynum,
struct
lxc_epoll_descr
descr
;
struct
lxc_epoll_descr
descr
;
struct
termios
oldtios
;
struct
termios
oldtios
;
struct
lxc_tty_state
*
ts
;
struct
lxc_tty_state
*
ts
;
int
istty
=
0
;
i
f
(
!
isatty
(
stdinfd
))
{
i
stty
=
isatty
(
stdinfd
);
ERROR
(
"stdin is not a tty"
);
if
(
istty
)
{
ret
urn
-
1
;
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
)
;
}
if
(
ret
)
{
ERROR
(
"failed to setup terminal properties"
);
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
)
;
return
-
1
;
if
(
ret
)
{
}
ERROR
(
"failed to setup tios"
);
}
else
{
return
-
1
;
INFO
(
"fd %d does not refer to a tty device"
,
stdinfd
)
;
}
}
ttyfd
=
lxc_cmd_console
(
c
->
name
,
&
ttynum
,
&
masterfd
,
c
->
config_path
);
ttyfd
=
lxc_cmd_console
(
c
->
name
,
&
ttynum
,
&
masterfd
,
c
->
config_path
);
...
@@ -687,8 +693,10 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -687,8 +693,10 @@ int lxc_console(struct lxc_container *c, int ttynum,
ts
->
winch_proxy_lxcpath
=
c
->
config_path
;
ts
->
winch_proxy_lxcpath
=
c
->
config_path
;
ts
->
stdoutfd
=
stdoutfd
;
ts
->
stdoutfd
=
stdoutfd
;
lxc_console_winsz
(
stdinfd
,
masterfd
);
if
(
istty
)
{
lxc_cmd_console_winch
(
ts
->
winch_proxy
,
ts
->
winch_proxy_lxcpath
);
lxc_console_winsz
(
stdinfd
,
masterfd
);
lxc_cmd_console_winch
(
ts
->
winch_proxy
,
ts
->
winch_proxy_lxcpath
);
}
ret
=
lxc_mainloop_open
(
&
descr
);
ret
=
lxc_mainloop_open
(
&
descr
);
if
(
ret
)
{
if
(
ret
)
{
...
@@ -745,8 +753,10 @@ err2:
...
@@ -745,8 +753,10 @@ err2:
close
(
masterfd
);
close
(
masterfd
);
close
(
ttyfd
);
close
(
ttyfd
);
err1
:
err1
:
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
);
if
(
istty
)
{
if
(
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
)
<
0
)
WARN
(
"failed to reset terminal properties: %s."
,
strerror
(
errno
));
}
return
ret
;
return
ret
;
}
}
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