summaryrefslogtreecommitdiff
path: root/src/machine
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine')
-rw-r--r--src/machine/machine-dbus.c7
-rw-r--r--src/machine/machinectl.c2
2 files changed, 7 insertions, 2 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;
diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c
index ccee16f2a8..b9e8381e6c 100644
--- a/src/machine/machinectl.c
+++ b/src/machine/machinectl.c
@@ -1053,7 +1053,7 @@ static int login_machine(int argc, char *argv[], void *userdata) {
r = sd_bus_message_read(reply, "hs", &master, &pty);
if (r < 0)
- return r;
+ return bus_log_parse_error(r);
p = startswith(pty, "/dev/pts/");
if (!p) {