projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
554c4be
)
nspawn: fix fd leak on failure path
author
Lennart Poettering
<lennart@poettering.net>
Wed, 16 Sep 2020 20:16:10 +0000
(22:16 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 17 Sep 2020 14:39:19 +0000
(16:39 +0200)
src/nspawn/nspawn.c
patch
|
blob
|
history
diff --git
a/src/nspawn/nspawn.c
b/src/nspawn/nspawn.c
index de9f1f534cae13352d3f0601d23309b03c1da876..1b7578581de564b94daeea91e05ec2871c6eb561 100644
(file)
--- a/
src/nspawn/nspawn.c
+++ b/
src/nspawn/nspawn.c
@@
-2275,7
+2275,7
@@
static int setup_pts(const char *dest) {
}
static int setup_stdio_as_dev_console(void) {
-
int terminal
;
+
_cleanup_close_ int terminal = -1
;
int r;
terminal = open_terminal("/dev/console", O_RDWR);
@@
-2290,6
+2290,7
@@
static int setup_stdio_as_dev_console(void) {
/* invalidates 'terminal' on success and failure */
r = rearrange_stdio(terminal, terminal, terminal);
+ TAKE_FD(terminal);
if (r < 0)
return log_error_errno(r, "Failed to move console to stdin/stdout/stderr: %m");