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
6810da44
Unverified
Commit
6810da44
authored
Apr 15, 2020
by
Christian Brauner
Committed by
Stéphane Graber
Apr 15, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
conf: fix tty cleanup
Fixes: Coverity 1461755. Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
c7c55c1a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
conf.c
src/lxc/conf.c
+5
-5
No files found.
src/lxc/conf.c
View file @
6810da44
...
@@ -901,11 +901,13 @@ static int lxc_setup_ttys(struct lxc_conf *conf)
...
@@ -901,11 +901,13 @@ static int lxc_setup_ttys(struct lxc_conf *conf)
return
0
;
return
0
;
}
}
define_cleanup_function
(
struct
lxc_tty_info
*
,
lxc_delete_tty
);
int
lxc_allocate_ttys
(
struct
lxc_conf
*
conf
)
int
lxc_allocate_ttys
(
struct
lxc_conf
*
conf
)
{
{
__do_free
struct
lxc_terminal_info
*
tty_new
=
NULL
;
struct
lxc_terminal_info
*
tty_new
=
NULL
;
int
ret
;
int
ret
;
struct
lxc_tty_info
*
ttys
=
&
conf
->
ttys
;
call_cleaner
(
lxc_delete_tty
)
struct
lxc_tty_info
*
ttys
=
&
conf
->
ttys
;
/* no tty in the configuration */
/* no tty in the configuration */
if
(
ttys
->
max
==
0
)
if
(
ttys
->
max
==
0
)
...
@@ -924,14 +926,12 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
...
@@ -924,14 +926,12 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
ret
=
openpty
(
&
tty
->
master
,
&
tty
->
slave
,
NULL
,
NULL
,
NULL
);
ret
=
openpty
(
&
tty
->
master
,
&
tty
->
slave
,
NULL
,
NULL
,
NULL
);
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ttys
->
max
=
i
;
ttys
->
max
=
i
;
lxc_delete_tty
(
ttys
);
return
log_error_errno
(
-
ENOTTY
,
ENOTTY
,
"Failed to create tty %zu"
,
i
);
return
log_error_errno
(
-
ENOTTY
,
ENOTTY
,
"Failed to create tty %zu"
,
i
);
}
}
ret
=
ttyname_r
(
tty
->
slave
,
tty
->
name
,
sizeof
(
tty
->
name
));
ret
=
ttyname_r
(
tty
->
slave
,
tty
->
name
,
sizeof
(
tty
->
name
));
if
(
ret
<
0
)
{
if
(
ret
<
0
)
{
ttys
->
max
=
i
;
ttys
->
max
=
i
;
lxc_delete_tty
(
ttys
);
return
log_error_errno
(
-
ENOTTY
,
ENOTTY
,
"Failed to retrieve name of tty %zu slave"
,
i
);
return
log_error_errno
(
-
ENOTTY
,
ENOTTY
,
"Failed to retrieve name of tty %zu slave"
,
i
);
}
}
...
@@ -953,7 +953,7 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
...
@@ -953,7 +953,7 @@ int lxc_allocate_ttys(struct lxc_conf *conf)
}
}
INFO
(
"Finished creating %zu tty devices"
,
ttys
->
max
);
INFO
(
"Finished creating %zu tty devices"
,
ttys
->
max
);
ttys
->
tty
=
move_ptr
(
tty_new
);
move_ptr
(
ttys
);
return
0
;
return
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