service: FileDescriptorStoreMax should also imply NotifyAccess

Commenting out "WatchdogTimeout=3min" in systemd-logind.service causes
NotifyAccess to go from "main" to "none", breaking support for logind
restart.  Let's fix that.
This commit is contained in:
Alan Jenkins 2018-05-14 15:45:09 +01:00 committed by Zbigniew Jędrzejewski-Szmek
parent d231d569d8
commit 4330dc03a0
2 changed files with 7 additions and 5 deletions

View file

@ -937,7 +937,10 @@
passed to the service manager from a specific service are passed back to the service's main process on the next
service restart. Any file descriptors passed to the service manager are automatically closed when
<constant>POLLHUP</constant> or <constant>POLLERR</constant> is seen on them, or when the service is fully
stopped and no job is queued or being executed for it.</para></listitem>
stopped and no job is queued or being executed for it. If this option is used, <varname>NotifyAccess=</varname>
(see above) should be set to open access to the notification socket provided by systemd. If
<varname>NotifyAccess=</varname> is not set, it will be implicitly set to
<option>main</option>.</para></listitem>
</varlistentry>
<varlistentry>

View file

@ -715,10 +715,9 @@ static int service_add_extras(Service *s) {
if (r < 0)
return r;
if (s->type == SERVICE_NOTIFY && s->notify_access == NOTIFY_NONE)
s->notify_access = NOTIFY_MAIN;
if (s->watchdog_usec > 0 && s->notify_access == NOTIFY_NONE)
/* If the service needs the notify socket, let's enable it automatically. */
if (s->notify_access == NOTIFY_NONE &&
(s->type == SERVICE_NOTIFY || s->watchdog_usec > 0 || s->n_fd_store_max > 0))
s->notify_access = NOTIFY_MAIN;
r = service_add_default_dependencies(s);