diff options
-rw-r--r-- | man/sd_bus_default.xml | 6 | ||||
-rw-r--r-- | man/sd_bus_new.xml | 16 | ||||
-rw-r--r-- | src/basic/path-util.c | 6 | ||||
-rw-r--r-- | src/basic/util.c | 2 | ||||
-rw-r--r-- | src/core/path.c | 2 | ||||
-rw-r--r-- | src/login/logind-dbus.c | 7 | ||||
-rw-r--r-- | src/login/logind-seat.c | 18 | ||||
-rw-r--r-- | src/login/logind-session.c | 10 | ||||
-rw-r--r-- | src/login/logind-session.h | 2 | ||||
-rw-r--r-- | src/shared/efivars.c | 14 | ||||
-rw-r--r-- | units/emergency.service.in | 2 |
11 files changed, 53 insertions, 32 deletions
diff --git a/man/sd_bus_default.xml b/man/sd_bus_default.xml index 95b347bdfd..782dfb5706 100644 --- a/man/sd_bus_default.xml +++ b/man/sd_bus_default.xml @@ -219,6 +219,12 @@ one. Use <citerefentry><refentrytitle>sd_bus_unref</refentrytitle><manvolnum>3</manvolnum></citerefentry> to drop the reference.</para> + + <para>Queued messages also keep a reference to the bus. For this reason, just + because no application is having a reference to the bus does not mean that + the bus object will be destroyed. Until all the messages are sent, the bus object + will stay alive. <function>sd_bus_flush</function> can be used to send all the + queued messages so they drop their references.</para> </refsect1> <refsect1> diff --git a/man/sd_bus_new.xml b/man/sd_bus_new.xml index 44744a0029..aff2ed2e83 100644 --- a/man/sd_bus_new.xml +++ b/man/sd_bus_new.xml @@ -77,8 +77,8 @@ <para><function>sd_bus_new()</function> creates a new bus object. This object is reference-counted, and will be destroyed when all references are gone. Initially, the caller of this - function owns the sole reference. The bus object will not be - connected to any bus initially. To connect it to a bus, make sure + function owns the sole reference and the bus object will not be + connected to any bus. To connect it to a bus, make sure to set an address with <citerefentry><refentrytitle>sd_bus_set_address</refentrytitle><manvolnum>3</manvolnum></citerefentry> or a related call, and then start the connection with @@ -94,15 +94,13 @@ well-known bus in a single function invocation.</para> <para><function>sd_bus_ref()</function> creates a new reference to - <parameter>bus</parameter>. This bus object will not be destroyed - until <function>sd_bus_unref()</function> has been called as many - times plus once more. Once the reference count has dropped to - zero, <parameter>bus</parameter> cannot be used anymore, so - further calls to <function>sd_bus_ref()</function> or - <function>sd_bus_unref()</function> are illegal.</para> + <parameter>bus</parameter>.</para> <para><function>sd_bus_unref()</function> destroys a reference to - <parameter>bus</parameter>.</para> + <parameter>bus</parameter>. Once the reference count has dropped + to zero, <parameter>bus</parameter> cannot be used anymore, so + further calls to <function>sd_bus_ref()</function> or + <function>sd_bus_unref()</function> are illegal.</para> </refsect1> <refsect1> diff --git a/src/basic/path-util.c b/src/basic/path-util.c index 8f49d65266..5cbfc145a4 100644 --- a/src/basic/path-util.c +++ b/src/basic/path-util.c @@ -656,9 +656,11 @@ int path_is_mount_point(const char *t, int flags) { canonical = canonicalize_file_name(t); if (!canonical) return -errno; + + t = canonical; } - r = path_get_parent(canonical ?: t, &parent); + r = path_get_parent(t, &parent); if (r < 0) return r; @@ -666,7 +668,7 @@ int path_is_mount_point(const char *t, int flags) { if (fd < 0) return -errno; - return fd_is_mount_point(fd, basename(canonical ?: t), flags); + return fd_is_mount_point(fd, basename(t), flags); } int path_is_read_only_fs(const char *path) { diff --git a/src/basic/util.c b/src/basic/util.c index c88cd1d38a..13a67e9ab8 100644 --- a/src/basic/util.c +++ b/src/basic/util.c @@ -2533,7 +2533,7 @@ int fopen_temporary(const char *path, FILE **_f, char **_temp_path) { f = fdopen(fd, "we"); if (!f) { - unlink(t); + unlink_noerrno(t); free(t); safe_close(fd); return -errno; diff --git a/src/core/path.c b/src/core/path.c index 6d26d89e82..20995d920c 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -426,7 +426,7 @@ static void path_set_state(Path *p, PathState state) { path_unwatch(p); if (state != old_state) - log_debug("Changed %s -> %s", path_state_to_string(old_state), path_state_to_string(state)); + log_unit_debug(UNIT(p), "Changed %s -> %s", path_state_to_string(old_state), path_state_to_string(state)); unit_notify(UNIT(p), state_translation_table[old_state], state_translation_table[state], true); } diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index cd9cab7334..ca435dfcbb 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -699,9 +699,12 @@ static int method_create_session(sd_bus_message *message, void *userdata, sd_bus * after the user-session and want the user-session to take * over the VT. We need to support this for * backwards-compatibility, so make sure we allow new sessions - * on a VT that a greeter is running on. + * on a VT that a greeter is running on. Furthermore, to allow + * re-logins, we have to allow a greeter to take over a used VT for + * the exact same reasons. */ - if (vtnr > 0 && + if (c != SESSION_GREETER && + vtnr > 0 && vtnr < m->seat0->position_count && m->seat0->positions[vtnr] && m->seat0->positions[vtnr]->class != SESSION_GREETER) diff --git a/src/login/logind-seat.c b/src/login/logind-seat.c index fb5d076311..9d5287ad35 100644 --- a/src/login/logind-seat.c +++ b/src/login/logind-seat.c @@ -290,8 +290,8 @@ int seat_switch_to_next(Seat *s) { return -EINVAL; start = 1; - if (s->active && s->active->pos > 0) - start = s->active->pos; + if (s->active && s->active->position > 0) + start = s->active->position; for (i = start + 1; i < s->position_count; ++i) if (s->positions[i]) @@ -311,8 +311,8 @@ int seat_switch_to_previous(Seat *s) { return -EINVAL; start = 1; - if (s->active && s->active->pos > 0) - start = s->active->pos; + if (s->active && s->active->position > 0) + start = s->active->position; for (i = start - 1; i > 0; --i) if (s->positions[i]) @@ -472,9 +472,9 @@ int seat_stop_sessions(Seat *s, bool force) { void seat_evict_position(Seat *s, Session *session) { Session *iter; - unsigned int pos = session->pos; + unsigned int pos = session->position; - session->pos = 0; + session->position = 0; if (pos == 0) return; @@ -486,7 +486,7 @@ void seat_evict_position(Seat *s, Session *session) { * position (eg., during gdm->session transition), so let's look * for it and set it on the free slot. */ LIST_FOREACH(sessions_by_seat, iter, s->sessions) { - if (iter->pos == pos) { + if (iter->position == pos) { s->positions[pos] = iter; break; } @@ -504,7 +504,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) { seat_evict_position(s, session); - session->pos = pos; + session->position = pos; if (pos > 0 && !s->positions[pos]) s->positions[pos] = session; } @@ -512,7 +512,7 @@ void seat_claim_position(Seat *s, Session *session, unsigned int pos) { static void seat_assign_position(Seat *s, Session *session) { unsigned int pos; - if (session->pos > 0) + if (session->position > 0) return; for (pos = 1; pos < s->position_count; ++pos) diff --git a/src/login/logind-session.c b/src/login/logind-session.c index 6a450b02a0..45f4c09d3d 100644 --- a/src/login/logind-session.c +++ b/src/login/logind-session.c @@ -264,7 +264,7 @@ int session_save(Session *s) { fprintf(f, "VTNR=%u\n", s->vtnr); if (!s->vtnr) - fprintf(f, "POS=%u\n", s->pos); + fprintf(f, "POSITION=%u\n", s->position); if (s->leader > 0) fprintf(f, "LEADER="PID_FMT"\n", s->leader); @@ -302,7 +302,7 @@ int session_load(Session *s) { *seat = NULL, *vtnr = NULL, *state = NULL, - *pos = NULL, + *position = NULL, *leader = NULL, *type = NULL, *class = NULL, @@ -329,7 +329,7 @@ int session_load(Session *s) { "DESKTOP", &s->desktop, "VTNR", &vtnr, "STATE", &state, - "POS", &pos, + "POSITION", &position, "LEADER", &leader, "TYPE", &type, "CLASS", &class, @@ -388,10 +388,10 @@ int session_load(Session *s) { if (!s->seat || !seat_has_vts(s->seat)) s->vtnr = 0; - if (pos && s->seat) { + if (position && s->seat) { unsigned int npos; - safe_atou(pos, &npos); + safe_atou(position, &npos); seat_claim_position(s->seat, s, npos); } diff --git a/src/login/logind-session.h b/src/login/logind-session.h index 4bf739a44d..b8565ebf51 100644 --- a/src/login/logind-session.h +++ b/src/login/logind-session.h @@ -70,7 +70,7 @@ struct Session { Manager *manager; const char *id; - unsigned int pos; + unsigned int position; SessionType type; SessionClass class; diff --git a/src/shared/efivars.c b/src/shared/efivars.c index 0d6ecf52cf..347cd30b09 100644 --- a/src/shared/efivars.c +++ b/src/shared/efivars.c @@ -125,7 +125,19 @@ static int get_os_indications(uint64_t *os_indication) { return r; r = efi_get_variable(EFI_VENDOR_GLOBAL, "OsIndications", NULL, &v, &s); - if (r < 0) + if (r == -ENOENT) { + /* Some firmware implementations that do support + * OsIndications and report that with + * OsIndicationsSupported will remove the + * OsIndications variable when it is unset. Let's + * pretend it's 0 then, to hide this implementation + * detail. Note that this call will return -ENOENT + * then only if the support for OsIndications is + * missing entirely, as determined by + * efi_reboot_to_firmware_supported() above. */ + *os_indication = 0; + return 0; + } else if (r < 0) return r; else if (s != sizeof(uint64_t)) return -EINVAL; diff --git a/units/emergency.service.in b/units/emergency.service.in index 52b9b1cd03..8dc3cbdede 100644 --- a/units/emergency.service.in +++ b/units/emergency.service.in @@ -16,7 +16,7 @@ Before=shutdown.target [Service] Environment=HOME=/root WorkingDirectory=/root -ExecStartPre=-/bin/plymouth quit +ExecStartPre=-/bin/plymouth --wait quit ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.' ExecStart=-/bin/sh -c "@SULOGIN@; @SYSTEMCTL@ --job-mode=fail --no-block default" Type=idle |