]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
machine: make sure to call unlockpt() even for local host pty connections
authorLennart Poettering <lennart@poettering.net>
Sat, 5 Sep 2015 18:24:52 +0000 (20:24 +0200)
committerLennart Poettering <lennart@poettering.net>
Sat, 5 Sep 2015 18:27:52 +0000 (20:27 +0200)
This fixes breakage for local host pty handling, introduced in
395745ba533ac91fe118f43ec83f13a752c0b473.

Fixes #1139

src/machine/machine.c

index 0d1b119dc1b248b88317b4b756d47057f3fa22b9..a056ec3b080e8c446d0e55cc247d0c0e70b1bf71 100644 (file)
@@ -547,8 +547,18 @@ int machine_openpt(Machine *m, int flags) {
 
         switch (m->class) {
 
-        case MACHINE_HOST:
-                return posix_openpt(flags);
+        case MACHINE_HOST: {
+                int fd;
+
+                fd = posix_openpt(flags);
+                if (fd < 0)
+                        return -errno;
+
+                if (unlockpt(fd) < 0)
+                        return -errno;
+
+                return fd;
+        }
 
         case MACHINE_CONTAINER:
                 if (m->leader <= 0)