[systemd-commits] 5 commits - src/logind.c src/logind-dbus.c src/logind-seat.c src/logind-session.c src/logind-user.c
Lennart Poettering
lennart at kemper.freedesktop.org
Mon Jun 27 14:08:51 PDT 2011
src/logind-dbus.c | 2 +-
src/logind-seat.c | 3 +++
src/logind-session.c | 18 +++++++++++++-----
src/logind-user.c | 3 +++
src/logind.c | 11 +++++++++--
5 files changed, 29 insertions(+), 8 deletions(-)
New commits:
commit bf1009201de83bb8c511d3a40d6a499d57f0fda7
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jun 27 23:08:42 2011 +0200
logind: fix bad memory access
diff --git a/src/logind-dbus.c b/src/logind-dbus.c
index 050eb71..9b199de 100644
--- a/src/logind-dbus.c
+++ b/src/logind-dbus.c
@@ -258,7 +258,7 @@ static int bus_manager_create_session(Manager *m, DBusMessage *message, DBusMess
else if (vtnr != (uint32_t) v)
return -EINVAL;
- } else if (!isempty(tty) && seat_is_vtconsole(s))
+ } else if (!isempty(tty) && s && seat_is_vtconsole(s))
return -EINVAL;
if (s) {
commit bafd4449ff851076b69ffaf918068465a726d928
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jun 27 23:07:28 2011 +0200
logind: properly detect whether we got the bus name
diff --git a/src/logind.c b/src/logind.c
index 2577320..863b163 100644
--- a/src/logind.c
+++ b/src/logind.c
@@ -764,8 +764,15 @@ static int manager_connect_bus(Manager *m) {
goto fail;
}
- if (dbus_bus_request_name(m->bus, "org.freedesktop.login1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error) < 0) {
- log_error("Failed to register name on bus: %s", error.message);
+ r = dbus_bus_request_name(m->bus, "org.freedesktop.login1", DBUS_NAME_FLAG_DO_NOT_QUEUE, &error);
+ if (dbus_error_is_set(&error)) {
+ log_error("Failed to register name on bus: %s", bus_error_message(&error));
+ r = -EIO;
+ goto fail;
+ }
+
+ if (r != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) {
+ log_error("Failed to acquire name.");
r = -EEXIST;
goto fail;
}
commit e9816c4859454d341279f1c9e77df4af4bacd534
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jun 27 23:07:13 2011 +0200
logind: check whether newly created session is active
diff --git a/src/logind-session.c b/src/logind-session.c
index 705b1e4..8e35e09 100644
--- a/src/logind-session.c
+++ b/src/logind-session.c
@@ -511,13 +511,16 @@ int session_start(Session *s) {
/* Create X11 symlink */
session_link_x11_socket(s);
- /* Save session data */
- session_save(s);
-
dual_timestamp_get(&s->timestamp);
+ if (s->seat)
+ seat_read_active_vt(s->seat);
+
s->started = true;
+ /* Save session data */
+ session_save(s);
+
session_send_signal(s, true);
if (s->seat) {
commit b6f68af13cadcbbfefd38cf8ff9a46553576f3af
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jun 27 23:06:49 2011 +0200
logind: when the leader of a session exited, don't fail
diff --git a/src/logind-session.c b/src/logind-session.c
index cbde810..705b1e4 100644
--- a/src/logind-session.c
+++ b/src/logind-session.c
@@ -408,9 +408,11 @@ static int session_create_one_group(Session *s, const char *controller, const ch
assert(controller);
assert(path);
- if (s->leader > 0)
+ if (s->leader > 0) {
r = cg_create_and_attach(controller, path, s->leader);
- else
+ if (r < 0)
+ r = cg_create(controller, path);
+ } else
r = cg_create(controller, path);
if (r < 0)
commit accaeded150b13685b188ea69f4b608d3cfa5463
Author: Lennart Poettering <lennart at poettering.net>
Date: Mon Jun 27 23:06:34 2011 +0200
logind: save object data only when started fully
diff --git a/src/logind-seat.c b/src/logind-seat.c
index c232a87..df91cd0 100644
--- a/src/logind-seat.c
+++ b/src/logind-seat.c
@@ -86,6 +86,9 @@ int seat_save(Seat *s) {
assert(s);
+ if (!s->started)
+ return 0;
+
r = safe_mkdir("/run/systemd/seats", 0755, 0, 0);
if (r < 0)
goto finish;
diff --git a/src/logind-session.c b/src/logind-session.c
index 9fcbf46..cbde810 100644
--- a/src/logind-session.c
+++ b/src/logind-session.c
@@ -111,6 +111,9 @@ int session_save(Session *s) {
assert(s);
+ if (!s->started)
+ return 0;
+
r = safe_mkdir("/run/systemd/sessions", 0755, 0, 0);
if (r < 0)
goto finish;
diff --git a/src/logind-user.c b/src/logind-user.c
index dff317e..a4f7886 100644
--- a/src/logind-user.c
+++ b/src/logind-user.c
@@ -94,6 +94,9 @@ int user_save(User *u) {
assert(u);
assert(u->state_file);
+ if (!u->started)
+ return 0;
+
r = safe_mkdir("/run/systemd/users", 0755, 0, 0);
if (r < 0)
goto finish;
More information about the systemd-commits
mailing list