systemd/0584-Set-NOTIFY_SOCKET-for-control-procs-if-NotifyAccess-.patch

109 lines
4.6 KiB
Diff
Raw Normal View History

2014-10-13 14:21:01 +00:00
From a158dbf156acc8899806fe07daa295464e82b52b Mon Sep 17 00:00:00 2001
From: Brandon L Black <blblack@gmail.com>
Date: Sat, 11 Oct 2014 23:36:06 +0000
Subject: [PATCH] Set $NOTIFY_SOCKET for control procs if NotifyAccess=all
---
TODO | 2 --
src/core/service.c | 11 +----------
2 files changed, 1 insertion(+), 12 deletions(-)
diff --git a/TODO b/TODO
index 69ed60eaff..05a61a3953 100644
--- a/TODO
+++ b/TODO
@@ -167,8 +167,6 @@ Features:
* journalctl: add the ability to look for the most recent process of a binary. journalctl /usr/bin/X11 --pid=-1 or so...
-* set NOTIFY_SOCKET also for control processes
-
* mount_cgroup_controllers(): symlinks need to get the label applied
* For timer units: add some mechanisms so that timer units that trigger immediately on boot do not have the services
diff --git a/src/core/service.c b/src/core/service.c
index f551061366..76763441b0 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -883,7 +883,6 @@ static int service_spawn(
bool apply_permissions,
bool apply_chroot,
bool apply_tty_stdin,
- bool set_notify_socket,
bool is_control,
pid_t *_pid) {
@@ -948,7 +947,7 @@ static int service_spawn(
goto fail;
}
- if (set_notify_socket)
+ if (is_control ? s->notify_access == NOTIFY_ALL : s->notify_access != NOTIFY_NONE)
if (asprintf(our_env + n_env++, "NOTIFY_SOCKET=%s", UNIT(s)->manager->notify_socket) < 0) {
r = -ENOMEM;
goto fail;
@@ -1153,7 +1152,6 @@ static void service_enter_stop_post(Service *s, ServiceResult f) {
!s->permissions_start_only,
!s->root_directory_start_only,
true,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1253,7 +1251,6 @@ static void service_enter_stop(Service *s, ServiceResult f) {
!s->permissions_start_only,
!s->root_directory_start_only,
false,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1316,7 +1313,6 @@ static void service_enter_start_post(Service *s) {
!s->permissions_start_only,
!s->root_directory_start_only,
false,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1383,7 +1379,6 @@ static void service_enter_start(Service *s) {
true,
true,
true,
- s->notify_access != NOTIFY_NONE,
false,
&pid);
if (r < 0)
@@ -1449,7 +1444,6 @@ static void service_enter_start_pre(Service *s) {
!s->permissions_start_only,
!s->root_directory_start_only,
true,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1530,7 +1524,6 @@ static void service_enter_reload(Service *s) {
!s->permissions_start_only,
!s->root_directory_start_only,
false,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1568,7 +1561,6 @@ static void service_run_next_control(Service *s) {
!s->root_directory_start_only,
s->control_command_id == SERVICE_EXEC_START_PRE ||
s->control_command_id == SERVICE_EXEC_STOP_POST,
- false,
true,
&s->control_pid);
if (r < 0)
@@ -1611,7 +1603,6 @@ static void service_run_next_main(Service *s) {
true,
true,
true,
- s->notify_access != NOTIFY_NONE,
false,
&pid);
if (r < 0)