summaryrefslogtreecommitdiff
path: root/src/login
diff options
context:
space:
mode:
Diffstat (limited to 'src/login')
-rw-r--r--src/login/logind-dbus.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c
index 7b9bd201b2..ed5d8d888c 100644
--- a/src/login/logind-dbus.c
+++ b/src/login/logind-dbus.c
@@ -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);