summaryrefslogtreecommitdiff
path: root/src/login/sd-login.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2014-02-11 17:15:38 +0100
committerLennart Poettering <lennart@poettering.net>2014-02-11 17:16:08 +0100
commit89f7c8465cd1ab37347dd0c15920bce31e8225df (patch)
tree2db96d4cc6b4ee0e81c420b480b6c177228e38b3 /src/login/sd-login.c
parent2d2ebd6b8f0775b93480bf05464865a0c78a9390 (diff)
machined: optionally, allow registration of pre-existing units (scopes
or services) as machine with machined
Diffstat (limited to 'src/login/sd-login.c')
-rw-r--r--src/login/sd-login.c27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
index c795765620..ef67040ebc 100644
--- a/src/login/sd-login.c
+++ b/src/login/sd-login.c
@@ -630,7 +630,32 @@ _public_ int sd_get_uids(uid_t **users) {
}
_public_ int sd_get_machine_names(char ***machines) {
- return get_files_in_directory("/run/systemd/machines/", machines);
+ char **l = NULL, **a, **b;
+ int r;
+
+ r = get_files_in_directory("/run/systemd/machines/", &l);
+ if (r < 0)
+ return r;
+
+ if (l) {
+ r = 0;
+
+ /* Filter out the unit: symlinks */
+ for (a = l, b = l; *a; a++) {
+ if (startswith(*a, "unit:"))
+ free(*a);
+ else {
+ *b = *a;
+ b++;
+ r++;
+ }
+ }
+
+ *b = NULL;
+ }
+
+ *machines = l;
+ return r;
}
static inline int MONITOR_TO_FD(sd_login_monitor *m) {