Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
criu
Project
Project
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
zhul
criu
Commits
bc535380
Commit
bc535380
authored
Feb 18, 2015
by
Pavel Emelyanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tty: Sanitize ctl terminal restore codeflow
Signed-off-by:
Pavel Emelyanov
<
xemul@parallels.com
>
parent
d47975b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
18 deletions
+10
-18
tty.c
tty.c
+10
-18
No files found.
tty.c
View file @
bc535380
...
@@ -584,6 +584,7 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
...
@@ -584,6 +584,7 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
struct
tty_info
*
info
=
container_of
(
d
,
struct
tty_info
,
d
);
struct
tty_info
*
info
=
container_of
(
d
,
struct
tty_info
,
d
);
struct
tty_type
*
type
=
info
->
type
;
struct
tty_type
*
type
=
info
->
type
;
struct
reg_file_info
*
fake
=
NULL
;
struct
reg_file_info
*
fake
=
NULL
;
struct
file_desc
*
slave_d
;
int
slave
=
-
1
,
ret
=
-
1
,
index
=
-
1
;
int
slave
=
-
1
,
ret
=
-
1
,
index
=
-
1
;
if
(
!
is_service_fd
(
fd
,
CTL_TTY_OFF
))
if
(
!
is_service_fd
(
fd
,
CTL_TTY_OFF
))
...
@@ -598,25 +599,16 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
...
@@ -598,25 +599,16 @@ static int tty_restore_ctl_terminal(struct file_desc *d, int fd)
fake
=
pty_alloc_fake_slave
(
info
);
fake
=
pty_alloc_fake_slave
(
info
);
if
(
!
fake
)
if
(
!
fake
)
goto
err
;
goto
err
;
slave
=
open_pty_reg
(
&
fake
->
d
,
O_RDONLY
);
if
(
slave
<
0
)
{
slave_d
=
&
fake
->
d
;
pr_perror
(
"Can't open %s"
,
path_from_reg
(
&
fake
->
d
));
goto
err
;
}
}
else
if
(
info
->
type
->
t
==
TTY_TYPE_CONSOLE
)
{
slave
=
open_pty_reg
(
info
->
reg_d
,
O_RDONLY
);
if
(
slave
<
0
)
{
pr_perror
(
"Can't open %s"
,
path_from_reg
(
info
->
reg_d
));
goto
err
;
}
}
else
if
(
info
->
type
->
t
==
TTY_TYPE_VT
)
{
slave
=
open_pty_reg
(
info
->
reg_d
,
O_RDONLY
);
if
(
slave
<
0
)
{
pr_perror
(
"Can't open %s"
,
path_from_reg
(
info
->
reg_d
));
goto
err
;
}
}
else
}
else
BUG
();
slave_d
=
info
->
reg_d
;
slave
=
open_pty_reg
(
slave_d
,
O_RDONLY
);
if
(
slave
<
0
)
{
pr_perror
(
"Can't open %s"
,
path_from_reg
(
slave_d
));
goto
err
;
}
pr_info
(
"Restore session %d by %d tty (index %d)
\n
"
,
pr_info
(
"Restore session %d by %d tty (index %d)
\n
"
,
info
->
tie
->
sid
,
(
int
)
getpid
(),
index
);
info
->
tie
->
sid
,
(
int
)
getpid
(),
index
);
...
...
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