mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
logind: make sure login sessions are terminated with SIGHUP
bash ignores SIGTERM, and can only be terminated cleanly via SIGHUP. Hence make sure that we the scope unit for the session is created with SendSIGHUP enabled.
This commit is contained in:
parent
07beec1244
commit
743e894540
Notes:
Lennart Poettering
2013-10-04 17:11:46 +02:00
Backport: bugfix
@ -2526,11 +2526,11 @@ int manager_start_scope(
|
||||
DBusError *error,
|
||||
char **job) {
|
||||
|
||||
const char *timeout_stop_property = "TimeoutStopUSec", *send_sighup_property = "SendSIGHUP", *pids_property = "PIDs";
|
||||
_cleanup_dbus_message_unref_ DBusMessage *m = NULL, *reply = NULL;
|
||||
DBusMessageIter iter, sub, sub2, sub3, sub4;
|
||||
const char *timeout_stop_property = "TimeoutStopUSec";
|
||||
const char *pids_property = "PIDs";
|
||||
uint64_t timeout = 500 * USEC_PER_MSEC;
|
||||
dbus_bool_t send_sighup = true;
|
||||
const char *fail = "fail";
|
||||
uint32_t u;
|
||||
|
||||
@ -2607,6 +2607,16 @@ int manager_start_scope(
|
||||
!dbus_message_iter_close_container(&sub, &sub2))
|
||||
return log_oom();
|
||||
|
||||
/* Make sure that the session shells are terminated with
|
||||
* SIGHUP since bash and friends tend to ignore SIGTERM */
|
||||
if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2) ||
|
||||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &send_sighup_property) ||
|
||||
!dbus_message_iter_open_container(&sub2, DBUS_TYPE_VARIANT, "b", &sub3) ||
|
||||
!dbus_message_iter_append_basic(&sub3, DBUS_TYPE_BOOLEAN, &send_sighup) ||
|
||||
!dbus_message_iter_close_container(&sub2, &sub3) ||
|
||||
!dbus_message_iter_close_container(&sub, &sub2))
|
||||
return log_oom();
|
||||
|
||||
u = pid;
|
||||
if (!dbus_message_iter_open_container(&sub, DBUS_TYPE_STRUCT, NULL, &sub2) ||
|
||||
!dbus_message_iter_append_basic(&sub2, DBUS_TYPE_STRING, &pids_property) ||
|
||||
@ -2615,8 +2625,10 @@ int manager_start_scope(
|
||||
!dbus_message_iter_append_basic(&sub4, DBUS_TYPE_UINT32, &u) ||
|
||||
!dbus_message_iter_close_container(&sub3, &sub4) ||
|
||||
!dbus_message_iter_close_container(&sub2, &sub3) ||
|
||||
!dbus_message_iter_close_container(&sub, &sub2) ||
|
||||
!dbus_message_iter_close_container(&iter, &sub))
|
||||
!dbus_message_iter_close_container(&sub, &sub2))
|
||||
return log_oom();
|
||||
|
||||
if (!dbus_message_iter_close_container(&iter, &sub))
|
||||
return log_oom();
|
||||
|
||||
reply = dbus_connection_send_with_reply_and_block(manager->bus, m, -1, error);
|
||||
|
Loading…
x
Reference in New Issue
Block a user