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
c83280b7
Unverified
Commit
c83280b7
authored
Nov 10, 2017
by
Stéphane Graber
Committed by
GitHub
Nov 10, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1916 from brauner/2017-11-10/fix_console_info_output
console: fix console info message
parents
b79628fc
6834f805
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
28 deletions
+26
-28
console.c
src/lxc/console.c
+26
-28
No files found.
src/lxc/console.c
View file @
c83280b7
...
@@ -777,26 +777,9 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -777,26 +777,9 @@ int lxc_console(struct lxc_container *c, int ttynum,
struct
lxc_tty_state
*
ts
;
struct
lxc_tty_state
*
ts
;
int
istty
=
0
;
int
istty
=
0
;
istty
=
isatty
(
stdinfd
);
if
(
istty
)
{
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
);
if
(
ret
<
0
)
return
-
1
;
}
else
{
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
;
return
-
1
;
goto
restore_tios
;
}
fprintf
(
stderr
,
"
\n
"
"Connected to tty %1$d
\n
"
"Type <Ctrl+%2$c q> to exit the console, "
"<Ctrl+%2$c Ctrl+%2$c> to enter Ctrl+%2$c itself
\n
"
,
ttynum
,
'a'
+
escape
-
1
);
ret
=
setsid
();
ret
=
setsid
();
if
(
ret
<
0
)
if
(
ret
<
0
)
...
@@ -812,9 +795,12 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -812,9 +795,12 @@ 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
;
istty
=
isatty
(
stdinfd
);
if
(
istty
)
{
if
(
istty
)
{
lxc_console_winsz
(
stdinfd
,
masterfd
);
lxc_console_winsz
(
stdinfd
,
masterfd
);
lxc_cmd_console_winch
(
ts
->
winch_proxy
,
ts
->
winch_proxy_lxcpath
);
lxc_cmd_console_winch
(
ts
->
winch_proxy
,
ts
->
winch_proxy_lxcpath
);
}
else
{
INFO
(
"File descriptor %d does not refer to a tty device"
,
stdinfd
);
}
}
ret
=
lxc_mainloop_open
(
&
descr
);
ret
=
lxc_mainloop_open
(
&
descr
);
...
@@ -846,14 +832,34 @@ int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -846,14 +832,34 @@ int lxc_console(struct lxc_container *c, int ttynum,
goto
close_mainloop
;
goto
close_mainloop
;
}
}
fprintf
(
stderr
,
"
\n
"
"Connected to tty %1$d
\n
"
"Type <Ctrl+%2$c q> to exit the console, "
"<Ctrl+%2$c Ctrl+%2$c> to enter Ctrl+%2$c itself
\n
"
,
ttynum
,
'a'
+
escape
-
1
);
if
(
istty
)
{
ret
=
lxc_setup_tios
(
stdinfd
,
&
oldtios
);
if
(
ret
<
0
)
goto
close_mainloop
;
}
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
ret
=
lxc_mainloop
(
&
descr
,
-
1
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ERROR
(
"The mainloop returned an error"
);
ERROR
(
"The mainloop returned an error"
);
goto
close_mainloop
;
goto
restore_tios
;
}
}
ret
=
0
;
ret
=
0
;
restore_tios
:
if
(
istty
)
{
istty
=
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
);
if
(
istty
<
0
)
WARN
(
"%s - Failed to restore terminal properties"
,
strerror
(
errno
));
}
close_mainloop
:
close_mainloop
:
lxc_mainloop_close
(
&
descr
);
lxc_mainloop_close
(
&
descr
);
...
@@ -864,13 +870,5 @@ close_fds:
...
@@ -864,13 +870,5 @@ close_fds:
close
(
masterfd
);
close
(
masterfd
);
close
(
ttyfd
);
close
(
ttyfd
);
restore_tios
:
if
(
istty
)
{
istty
=
tcsetattr
(
stdinfd
,
TCSAFLUSH
,
&
oldtios
);
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