summaryrefslogtreecommitdiff
path: root/src/machine/machine-dbus.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-12-23 01:58:49 +0100
committerLennart Poettering <lennart@poettering.net>2014-12-23 03:26:24 +0100
commitee451d766a64117a41ec36dd71e61683c9d9b83c (patch)
tree12a05ec521818b9ed02b0d15811d82e2d6fc9f5d /src/machine/machine-dbus.c
parent40205d706e1210763ff4c98a317556375bd04bcd (diff)
systemd-run: support -t mode when combined with -M
For that, ask machined for a container PTY and use that.
Diffstat (limited to 'src/machine/machine-dbus.c')
-rw-r--r--src/machine/machine-dbus.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/machine/machine-dbus.c b/src/machine/machine-dbus.c
index 7cabe0f2ff..76c5dcf735 100644
--- a/src/machine/machine-dbus.c
+++ b/src/machine/machine-dbus.c
@@ -404,6 +404,7 @@ int bus_machine_method_open_pty(sd_bus *bus, sd_bus_message *message, void *user
.msg_controllen = sizeof(control),
};
Machine *m = userdata;
+ _cleanup_free_ char *pty_name = NULL;
struct cmsghdr *cmsg;
siginfo_t si;
pid_t child;
@@ -479,11 +480,15 @@ int bus_machine_method_open_pty(sd_bus *bus, sd_bus_message *message, void *user
if (master < 0)
return -EIO;
+ r = ptsname_malloc(master, &pty_name);
+ if (r < 0)
+ return r;
+
r = sd_bus_message_new_method_return(message, &reply);
if (r < 0)
return r;
- r = sd_bus_message_append(reply, "hs", master, ptsname(master));
+ r = sd_bus_message_append(reply, "hs", master, pty_name);
if (r < 0)
return r;