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
46768cce
Unverified
Commit
46768cce
authored
Apr 29, 2018
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coverity: #1435206
Time of check time of use Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
91ae555c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
22 deletions
+12
-22
terminal.c
src/lxc/terminal.c
+12
-22
No files found.
src/lxc/terminal.c
View file @
46768cce
...
@@ -667,33 +667,23 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
...
@@ -667,33 +667,23 @@ void lxc_terminal_free(struct lxc_conf *conf, int fd)
static
int
lxc_terminal_peer_default
(
struct
lxc_terminal
*
terminal
)
static
int
lxc_terminal_peer_default
(
struct
lxc_terminal
*
terminal
)
{
{
struct
lxc_terminal_state
*
ts
;
struct
lxc_terminal_state
*
ts
;
const
char
*
path
=
terminal
->
path
;
const
char
*
path
;
int
fd
;
int
ret
=
0
;
int
ret
=
0
;
if
(
!
path
)
{
if
(
terminal
->
path
)
ret
=
access
(
"/dev/tty"
,
F_OK
);
path
=
terminal
->
path
;
if
(
ret
==
0
)
{
else
/* If no terminal was given, try current controlling
path
=
"/dev/tty"
;
* terminal, there won't be one if we were started as a
* daemon (-d).
*/
fd
=
open
(
"/dev/tty"
,
O_RDWR
);
if
(
fd
>=
0
)
{
close
(
fd
);
path
=
"/dev/tty"
;
}
}
}
if
(
!
path
)
{
errno
=
ENOTTY
;
DEBUG
(
"The process does not have a controlling terminal"
);
goto
on_succes
;
}
terminal
->
peer
=
lxc_unpriv
(
open
(
path
,
O_RDWR
|
O_CLOEXEC
));
terminal
->
peer
=
lxc_unpriv
(
open
(
path
,
O_RDWR
|
O_CLOEXEC
));
if
(
terminal
->
peer
<
0
)
{
if
(
terminal
->
peer
<
0
)
{
if
(
!
terminal
->
path
)
{
errno
=
ENODEV
;
DEBUG
(
"%s - The process does not have a controlling "
"terminal"
,
strerror
(
errno
));
goto
on_succes
;
}
ERROR
(
"%s - Failed to open proxy terminal
\"
%s
\"
"
,
ERROR
(
"%s - Failed to open proxy terminal
\"
%s
\"
"
,
strerror
(
errno
),
path
);
strerror
(
errno
),
path
);
return
-
ENOTTY
;
return
-
ENOTTY
;
...
...
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