summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-12-23 19:15:43 +0100
committerLennart Poettering <lennart@poettering.net>2013-12-23 20:25:57 +0100
commit6261f11fc3d0a8b63c5afa5313d96607a008b54e (patch)
tree58a42557a0c74d001a9478feb71ae8ba1c584d29
parent94a6ce5b7c0ef1de16d67ef01374cbc08459d29e (diff)
machinectl: fix success check when getting pty from within container
-rw-r--r--src/machine/machinectl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index ab9060ab99..b3a70188a4 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -452,10 +452,7 @@ static int openpt_in_namespace(pid_t pid, int flags) {
pair[1] = -1;
r = wait_for_terminate(child, &si);
- if (r < 0 || si.si_code != CLD_EXITED || si.si_status != EXIT_SUCCESS || master < 0) {
-
- if (master >= 0)
- close_nointr_nofail(master);
+ if (r < 0 || si.si_code != CLD_EXITED || si.si_status != EXIT_SUCCESS) {
return r < 0 ? r : -EIO;
}
@@ -479,6 +476,9 @@ static int openpt_in_namespace(pid_t pid, int flags) {
master = fds[0];
}
+ if (master < 0)
+ return -EIO;
+
return master;
}