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
52c2c353
Unverified
Commit
52c2c353
authored
May 12, 2017
by
Christian Brauner
Committed by
Stéphane Graber
May 16, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lxc-attach: allow for situations without /dev/tty
Closes #1552. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
ba7e919e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
9 deletions
+6
-9
console.c
src/lxc/console.c
+1
-1
lxc_attach.c
src/lxc/tools/lxc_attach.c
+5
-8
No files found.
src/lxc/console.c
View file @
52c2c353
...
...
@@ -441,7 +441,7 @@ static int lxc_console_peer_default(struct lxc_console *console)
console
->
peer
=
lxc_unpriv
(
open
(
path
,
O_CLOEXEC
|
O_RDWR
|
O_CREAT
|
O_APPEND
,
0600
));
if
(
console
->
peer
<
0
)
{
ERROR
(
"failed to open
\"
%s
\"
"
,
path
);
ERROR
(
"failed to open
\"
%s
\"
: %s"
,
path
,
strerror
(
errno
)
);
return
-
ENOTTY
;
}
DEBUG
(
"using
\"
%s
\"
as peer tty device"
,
path
);
...
...
src/lxc/tools/lxc_attach.c
View file @
52c2c353
...
...
@@ -301,15 +301,12 @@ static int get_pty_on_host(struct lxc_container *c, struct wrapargs *wrap, int *
/* In the case of lxc-attach our peer pty will always be the current
* controlling terminal. We clear whatever was set by the user for
* lxc.console.path here and set it to "/dev/tty". Doing this will (a)
* prevent segfaults when the container has been setup with
* lxc.console = none and (b) provide an easy way to ensure that we
* always do the correct thing. strdup() must be used since console.path
* is free()ed when we call lxc_container_put(). */
* lxc.console.path here and set it NULL. lxc_console_peer_default()
* will then try to open /dev/tty. If the process doesn't have a
* controlling terminal we should still proceed.
*/
free
(
conf
->
console
.
path
);
conf
->
console
.
path
=
strdup
(
"/dev/tty"
);
if
(
!
conf
->
console
.
path
)
return
-
1
;
conf
->
console
.
path
=
NULL
;
/* Create pty on the host. */
if
(
lxc_console_create
(
conf
)
<
0
)
...
...
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