X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Flogin%2Flogind-user.c;h=2b80ff844c889f8d33f1899049d2d11ebd05f6c1;hb=9b958eff3fbcc345a72315a9167f6217dd841c40;hp=432d6092f54d4c5c72f81bc5c9cb049221f3ed34;hpb=1637a8be5570dff7ce402451240b28ddb54e5dca;p=elogind.git diff --git a/src/login/logind-user.c b/src/login/logind-user.c index 432d6092f..2b80ff844 100644 --- a/src/login/logind-user.c +++ b/src/login/logind-user.c @@ -6,16 +6,16 @@ Copyright 2011 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -25,6 +25,7 @@ #include "logind-user.h" #include "util.h" +#include "mkdir.h" #include "cgroup-util.h" #include "hashmap.h" #include "strv.h" @@ -136,40 +137,59 @@ int user_save(User *u) { if (u->sessions) { Session *i; + bool first; fputs("SESSIONS=", f); + first = true; LIST_FOREACH(sessions_by_user, i, u->sessions) { - fprintf(f, - "%s%c", - i->id, - i->sessions_by_user_next ? ' ' : '\n'); + if (first) + first = false; + else + fputc(' ', f); + + fputs(i->id, f); } - fputs("SEATS=", f); + fputs("\nSEATS=", f); + first = true; LIST_FOREACH(sessions_by_user, i, u->sessions) { - if (i->seat) - fprintf(f, - "%s%c", - i->seat->id, - i->sessions_by_user_next ? ' ' : '\n'); + if (!i->seat) + continue; + + if (first) + first = false; + else + fputc(' ', f); + + fputs(i->seat->id, f); } - fputs("ACTIVE_SESSIONS=", f); - LIST_FOREACH(sessions_by_user, i, u->sessions) - if (session_is_active(i)) - fprintf(f, - "%lu%c", - (unsigned long) i->user->uid, - i->sessions_by_user_next ? ' ' : '\n'); + fputs("\nACTIVE_SESSIONS=", f); + first = true; + LIST_FOREACH(sessions_by_user, i, u->sessions) { + if (!session_is_active(i)) + continue; + + if (first) + first = false; + else + fputc(' ', f); - fputs("ACTIVE_SEATS=", f); + fputs(i->id, f); + } + + fputs("\nACTIVE_SEATS=", f); + first = true; LIST_FOREACH(sessions_by_user, i, u->sessions) { - if (session_is_active(i) && i->seat) - fprintf(f, - "%s%c", - i->seat->id, - i->sessions_by_user_next ? ' ' : '\n'); + if (!session_is_active(i) || !i->seat) + continue; + + if (first) + first = false; + else + fputs(i->seat->id, f); } + fputc('\n', f); } fflush(f); @@ -299,6 +319,8 @@ static int user_create_cgroup(User *u) { static int user_start_service(User *u) { assert(u); + /* FIXME: Fill me in later ... */ + return 0; }