@@ -1252,7 +1252,8 @@ static int service_spawn(
1252
1252
if (!our_env )
1253
1253
return - ENOMEM ;
1254
1254
1255
- if ((flags & EXEC_IS_CONTROL ) ? s -> notify_access == NOTIFY_ALL : s -> notify_access != NOTIFY_NONE )
1255
+ if ((flags & EXEC_IS_CONTROL ) ? IN_SET (s -> notify_access , NOTIFY_ALL , NOTIFY_EXEC )
1256
+ : s -> notify_access != NOTIFY_NONE )
1256
1257
if (asprintf (our_env + n_env ++ , "NOTIFY_SOCKET=%s" , UNIT (s )-> manager -> notify_socket ) < 0 )
1257
1258
return - ENOMEM ;
1258
1259
@@ -3059,6 +3060,16 @@ static void service_notify_message(Unit *u, pid_t pid, char **tags, FDSet *fds)
3059
3060
else
3060
3061
log_unit_debug (u , "Got notification message from PID " PID_FMT ", but reception only permitted for main PID which is currently not known" , pid );
3061
3062
return ;
3063
+ } else if (s -> notify_access == NOTIFY_EXEC && pid != s -> main_pid && pid != s -> control_pid ) {
3064
+ if (s -> main_pid != 0 && s -> control_pid != 0 )
3065
+ log_unit_warning (u , "Got notification message from PID " PID_FMT ", but reception only permitted for main PID " PID_FMT " and control PID " PID_FMT ,
3066
+ pid , s -> main_pid , s -> control_pid );
3067
+ else if (s -> main_pid != 0 || s -> control_pid != 0 )
3068
+ log_unit_warning (u , "Got notification message from PID " PID_FMT ", but reception only permitted for %s PID " PID_FMT ,
3069
+ pid , s -> main_pid ? "main" : "control" , s -> main_pid | s -> control_pid );
3070
+ else
3071
+ log_unit_debug (u , "Got notification message from PID " PID_FMT ", but reception only permitted for main PID and control PID which are currently not known" , pid );
3072
+ return ;
3062
3073
} else
3063
3074
log_unit_debug (u , "Got notification message from PID " PID_FMT " (%s)" , pid , isempty (cc ) ? "n/a" : cc );
3064
3075
@@ -3384,6 +3395,7 @@ DEFINE_STRING_TABLE_LOOKUP(service_exec_command, ServiceExecCommand);
3384
3395
static const char * const notify_access_table [_NOTIFY_ACCESS_MAX ] = {
3385
3396
[NOTIFY_NONE ] = "none" ,
3386
3397
[NOTIFY_MAIN ] = "main" ,
3398
+ [NOTIFY_EXEC ] = "exec" ,
3387
3399
[NOTIFY_ALL ] = "all"
3388
3400
};
3389
3401
0 commit comments