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
33b4b411
Unverified
Commit
33b4b411
authored
Oct 26, 2017
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: non-functional changes
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
63b74cda
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
29 deletions
+32
-29
console.c
src/lxc/console.c
+32
-29
No files found.
src/lxc/console.c
View file @
33b4b411
...
@@ -780,18 +780,16 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -780,18 +780,16 @@ int lxc_console(struct lxc_container *c, int ttynum,
istty
=
isatty
(
stdinfd
);
istty
=
isatty
(
stdinfd
);
if
(
istty
)
{
if
(
istty
)
{
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
);
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
);
if
(
ret
)
{
if
(
ret
<
0
)
ERROR
(
"failed to setup terminal properties"
);
return
-
1
;
return
-
1
;
}
}
else
{
}
else
{
INFO
(
"
fd
%d does not refer to a tty device"
,
stdinfd
);
INFO
(
"
File descriptor
%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
);
if
(
ttyfd
<
0
)
{
if
(
ttyfd
<
0
)
{
ret
=
ttyfd
;
ret
=
ttyfd
;
goto
err1
;
goto
restore_tios
;
}
}
fprintf
(
stderr
,
"
\n
"
fprintf
(
stderr
,
"
\n
"
...
@@ -801,13 +799,13 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -801,13 +799,13 @@ int lxc_console(struct lxc_container *c, int ttynum,
ttynum
,
'a'
+
escape
-
1
);
ttynum
,
'a'
+
escape
-
1
);
ret
=
setsid
();
ret
=
setsid
();
if
(
ret
)
if
(
ret
<
0
)
INFO
(
"
already group leader"
);
TRACE
(
"Process is
already group leader"
);
ts
=
lxc_console_sigwinch_init
(
stdinfd
,
masterfd
);
ts
=
lxc_console_sigwinch_init
(
stdinfd
,
masterfd
);
if
(
!
ts
)
{
if
(
!
ts
)
{
ret
=
-
1
;
ret
=
-
1
;
goto
err2
;
goto
close_fds
;
}
}
ts
->
escape
=
escape
;
ts
->
escape
=
escape
;
ts
->
winch_proxy
=
c
->
name
;
ts
->
winch_proxy
=
c
->
name
;
...
@@ -821,52 +819,57 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -821,52 +819,57 @@ int lxc_console(struct lxc_container *c, int ttynum,
ret
=
lxc_mainloop_open
(
&
descr
);
ret
=
lxc_mainloop_open
(
&
descr
);
if
(
ret
)
{
if
(
ret
)
{
ERROR
(
"
f
ailed to create mainloop"
);
ERROR
(
"
F
ailed to create mainloop"
);
goto
err3
;
goto
sigwinch_fini
;
}
}
if
(
ts
->
sigfd
!=
-
1
)
{
if
(
ts
->
sigfd
!=
-
1
)
{
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
sigfd
,
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
sigfd
,
lxc_console_cb_sigwinch_fd
,
ts
);
lxc_console_cb_sigwinch_fd
,
ts
);
if
(
ret
)
{
if
(
ret
<
0
)
{
ERROR
(
"
failed to add handler for SIGWINCH fd
"
);
ERROR
(
"
Failed to add SIGWINCH handler
"
);
goto
err4
;
goto
close_mainloop
;
}
}
}
}
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
stdinfd
,
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
stdinfd
,
lxc_console_cb_tty_stdin
,
ts
);
lxc_console_cb_tty_stdin
,
ts
);
if
(
ret
)
{
if
(
ret
<
0
)
{
ERROR
(
"
failed to add handler for stdinfd
"
);
ERROR
(
"
Failed to add stdin handler
"
);
goto
err4
;
goto
close_mainloop
;
}
}
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
masterfd
,
ret
=
lxc_mainloop_add_handler
(
&
descr
,
ts
->
masterfd
,
lxc_console_cb_tty_master
,
ts
);
lxc_console_cb_tty_master
,
ts
);
if
(
ret
)
{
if
(
ret
<
0
)
{
ERROR
(
"
failed to add handler for masterfd
"
);
ERROR
(
"
Failed to add master handler
"
);
goto
err4
;
goto
close_mainloop
;
}
}
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
if
(
ret
)
{
if
(
ret
<
0
)
{
ERROR
(
"mainloop returned an error"
);
ERROR
(
"
The
mainloop returned an error"
);
goto
err4
;
goto
close_mainloop
;
}
}
ret
=
0
;
ret
=
0
;
err4
:
close_mainloop
:
lxc_mainloop_close
(
&
descr
);
lxc_mainloop_close
(
&
descr
);
err3
:
sigwinch_fini
:
lxc_console_sigwinch_fini
(
ts
);
lxc_console_sigwinch_fini
(
ts
);
err2
:
close_fds
:
close
(
masterfd
);
close
(
masterfd
);
close
(
ttyfd
);
close
(
ttyfd
);
err1
:
restore_tios
:
if
(
istty
)
{
if
(
istty
)
{
if
(
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
)
<
0
)
istty
=
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
);
WARN
(
"failed to reset terminal properties: %s."
,
strerror
(
errno
));
if
(
istty
<
0
)
WARN
(
"%s - Failed to restore terminal properties"
,
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