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
582d4741
Unverified
Commit
582d4741
authored
Jan 19, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
console: cleanup
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
76f61234
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
8 deletions
+16
-8
console.c
src/lxc/console.c
+16
-8
No files found.
src/lxc/console.c
View file @
582d4741
...
...
@@ -51,6 +51,8 @@
#include <../include/openpty.h>
#endif
#define LXC_CONSOLE_BUFFER_SIZE 1024
lxc_log_define
(
console
,
lxc
);
static
struct
lxc_list
lxc_ttys
;
...
...
@@ -206,12 +208,12 @@ int lxc_console_cb_con(int fd, uint32_t events, void *data,
struct
lxc_epoll_descr
*
descr
)
{
struct
lxc_console
*
console
=
(
struct
lxc_console
*
)
data
;
char
buf
[
1024
];
int
r
,
w
;
char
buf
[
LXC_CONSOLE_BUFFER_SIZE
];
int
r
,
w
,
w_log
;
w
=
r
=
lxc_read_nointr
(
fd
,
buf
,
sizeof
(
buf
));
if
(
r
<=
0
)
{
INFO
(
"
c
onsole client on fd %d has exited"
,
fd
);
INFO
(
"
C
onsole client on fd %d has exited"
,
fd
);
lxc_mainloop_del_handler
(
descr
,
fd
);
if
(
fd
==
console
->
peer
)
{
if
(
console
->
tty_state
)
{
...
...
@@ -229,16 +231,22 @@ int lxc_console_cb_con(int fd, uint32_t events, void *data,
if
(
fd
==
console
->
peer
)
w
=
lxc_write_nointr
(
console
->
master
,
buf
,
r
);
w_log
=
0
;
if
(
fd
==
console
->
master
)
{
if
(
console
->
log_fd
>=
0
)
w
=
lxc_write_nointr
(
console
->
log_fd
,
buf
,
r
);
/* write to peer first */
if
(
console
->
peer
>=
0
)
w
=
lxc_write_nointr
(
console
->
peer
,
buf
,
r
);
/* write to console log */
if
(
console
->
log_fd
>=
0
)
w_log
=
lxc_write_nointr
(
console
->
log_fd
,
buf
,
r
);
}
if
(
w
!=
r
)
WARN
(
"console short write r:%d w:%d"
,
r
,
w
);
WARN
(
"Console short write r:%d != w:%d"
,
r
,
w
);
if
(
w_log
<
0
)
TRACE
(
"Failed to write %d bytes to console log"
,
r
);
return
0
;
}
...
...
@@ -721,7 +729,7 @@ int lxc_console_cb_tty_master(int fd, uint32_t events, void *cbdata,
struct
lxc_epoll_descr
*
descr
)
{
struct
lxc_tty_state
*
ts
=
cbdata
;
char
buf
[
1024
];
char
buf
[
LXC_CONSOLE_BUFFER_SIZE
];
int
r
,
w
;
if
(
fd
!=
ts
->
masterfd
)
...
...
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