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
39a78bbe
Commit
39a78bbe
authored
Feb 17, 2016
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite lxc_console_set_stdfds
Make lxc_console_set_stdfds useable by other callers that do not have access to lxc_handler. Signed-off-by:
Christian Brauner
<
christian.brauner@mailbox.org
>
parent
0d4137cc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
14 deletions
+22
-14
console.c
src/lxc/console.c
+20
-12
console.h
src/lxc/console.h
+1
-1
start.c
src/lxc/start.c
+1
-1
No files found.
src/lxc/console.c
View file @
39a78bbe
...
@@ -598,21 +598,29 @@ err:
...
@@ -598,21 +598,29 @@ err:
return
-
1
;
return
-
1
;
}
}
int
lxc_console_set_stdfds
(
struct
lxc_handler
*
handler
)
int
lxc_console_set_stdfds
(
int
fd
)
{
{
struct
lxc_conf
*
conf
=
handler
->
conf
;
if
(
fd
<
0
)
struct
lxc_console
*
console
=
&
conf
->
console
;
if
(
console
->
slave
<
0
)
return
0
;
return
0
;
if
(
dup2
(
console
->
slave
,
0
)
<
0
||
if
(
isatty
(
STDIN_FILENO
))
dup2
(
console
->
slave
,
1
)
<
0
||
if
(
dup2
(
fd
,
STDIN_FILENO
)
<
0
)
{
dup2
(
console
->
slave
,
2
)
<
0
)
SYSERROR
(
"failed to duplicate stdin."
);
{
return
-
1
;
SYSERROR
(
"failed to dup console"
);
}
return
-
1
;
}
if
(
isatty
(
STDOUT_FILENO
))
if
(
dup2
(
fd
,
STDOUT_FILENO
)
<
0
)
{
SYSERROR
(
"failed to duplicate stdout."
);
return
-
1
;
}
if
(
isatty
(
STDERR_FILENO
))
if
(
dup2
(
fd
,
STDERR_FILENO
)
<
0
)
{
SYSERROR
(
"failed to duplicate stderr."
);
return
-
1
;
}
return
0
;
return
0
;
}
}
...
...
src/lxc/console.h
View file @
39a78bbe
...
@@ -55,7 +55,7 @@ extern int lxc_console(struct lxc_container *c, int ttynum,
...
@@ -55,7 +55,7 @@ extern int lxc_console(struct lxc_container *c, int ttynum,
int
escape
);
int
escape
);
extern
int
lxc_console_getfd
(
struct
lxc_container
*
c
,
int
*
ttynum
,
extern
int
lxc_console_getfd
(
struct
lxc_container
*
c
,
int
*
ttynum
,
int
*
masterfd
);
int
*
masterfd
);
extern
int
lxc_console_set_stdfds
(
struct
lxc_handler
*
);
extern
int
lxc_console_set_stdfds
(
int
fd
);
extern
int
lxc_console_cb_tty_stdin
(
int
fd
,
uint32_t
events
,
void
*
cbdata
,
extern
int
lxc_console_cb_tty_stdin
(
int
fd
,
uint32_t
events
,
void
*
cbdata
,
struct
lxc_epoll_descr
*
descr
);
struct
lxc_epoll_descr
*
descr
);
extern
int
lxc_console_cb_tty_master
(
int
fd
,
uint32_t
events
,
void
*
cbdata
,
extern
int
lxc_console_cb_tty_master
(
int
fd
,
uint32_t
events
,
void
*
cbdata
,
...
...
src/lxc/start.c
View file @
39a78bbe
...
@@ -798,7 +798,7 @@ static int do_start(void *data)
...
@@ -798,7 +798,7 @@ static int do_start(void *data)
* setup on its console ie. the pty allocated in lxc_console_create()
* setup on its console ie. the pty allocated in lxc_console_create()
* so make sure that that pty is stdin,stdout,stderr.
* so make sure that that pty is stdin,stdout,stderr.
*/
*/
if
(
lxc_console_set_stdfds
(
handler
)
<
0
)
if
(
lxc_console_set_stdfds
(
handler
->
conf
->
console
.
slave
)
<
0
)
goto
out_warn_father
;
goto
out_warn_father
;
/* If we mounted a temporary proc, then unmount it now */
/* If we mounted a temporary proc, then unmount it now */
...
...
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