summaryrefslogtreecommitdiff
path: root/src/libsystemd/sd-login/sd-login.c
diff options
context:
space:
mode:
authorTom Gundersen <teg@jklm.no>2015-08-25 16:46:27 +0200
committerTom Gundersen <teg@jklm.no>2015-08-25 16:46:27 +0200
commit498fb56739a5d18cb85d2ba3523759b1d141d770 (patch)
treed68a7330da711f320063046007cddfbf469fea6f /src/libsystemd/sd-login/sd-login.c
parent3ad216b44f4f5cba168f449ae455607a442cfd4c (diff)
parentef3100e9637adda26fa19e7ee8606788320dcde3 (diff)
Merge pull request #1022 from poettering/machinectl-shell
Add new "machinectl shell" command for su(1)-like behaviour
Diffstat (limited to 'src/libsystemd/sd-login/sd-login.c')
-rw-r--r--src/libsystemd/sd-login/sd-login.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/libsystemd/sd-login/sd-login.c b/src/libsystemd/sd-login/sd-login.c
index 9bbf8974dd..0eadc8c747 100644
--- a/src/libsystemd/sd-login/sd-login.c
+++ b/src/libsystemd/sd-login/sd-login.c
@@ -32,6 +32,7 @@
#include "fileio.h"
#include "login-util.h"
#include "formats-util.h"
+#include "hostname-util.h"
#include "sd-login.h"
_public_ int sd_pid_get_session(pid_t pid, char **session) {
@@ -790,7 +791,7 @@ _public_ int sd_get_machine_names(char ***machines) {
/* Filter out the unit: symlinks */
for (a = l, b = l; *a; a++) {
- if (startswith(*a, "unit:"))
+ if (startswith(*a, "unit:") || !machine_name_is_valid(*a))
free(*a);
else {
*b = *a;