SHA256
1
0
forked from pool/systemd
systemd/remain_after_exit-initscript-heuristic-and-add-new-LSB-hea.patch
Tomáš Chvátal f037c9430f Accepting request 202147 from Base:System
- Add 0001-acpi-fptd-fix-memory-leak-in-acpi_get_boot_usec.patch:
  fix acpi memleak.
- Add
  0002-fix-lingering-references-to-var-lib-backlight-random.patch:
  fix invalid path in documentation.
- Add
  0003-acpi-make-sure-we-never-free-an-uninitialized-pointe.patch:
  fix invalid memory free.
- Add 0004-systemctl-fix-name-mangling-for-sysv-units.patch: fix
  name mangling for sysv units.
- Add
  0005-cryptsetup-fix-OOM-handling-when-parsing-mount-optio.patch:
  fix OOM handling.
- Add 0006-journald-add-missing-error-check.patch: add missing
  error check.
- Add 0007-bus-fix-potentially-uninitialized-memory-access.patch:
  fix uninitialized memory access.
- Add 0008-dbus-fix-return-value-of-dispatch_rqueue.patch: fix
  return value.
- Add 0009-modules-load-fix-error-handling.patch: fix error
  handling.
- Add 0010-efi-never-call-qsort-on-potentially-NULL-arrays.patch:
  fix incorrect memory access.
- Add 0011-strv-don-t-access-potentially-NULL-string-arrays.patch:
  fix incorrect memory access.
- Add
  0012-mkdir-pass-a-proper-function-pointer-to-mkdir_safe_i.patch:
  fix invalid pointer.
- Add
  0014-tmpfiles.d-include-setgid-perms-for-run-log-journal.patch: (forwarded request 202117 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/202147
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=162
2013-10-04 14:07:46 +00:00

92 lines
3.9 KiB
Diff

From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 7 Dec 2011 15:15:07 +0000
Subject: remain_after_exit initscript heuristic and add new LSB headers
Add remain_after_exit heuristic for initscripts and add LSB headers
PIDFile: and X-Systemd-RemainAfterExit to control it.
(bnc#721426) (bnc#727771)
---
src/core/service.c | 34 ++++++++++++++++++++++++++++++++--
src/core/service.h | 1 +
2 files changed, 33 insertions(+), 2 deletions(-)
Index: systemd-208/src/core/service.c
===================================================================
--- systemd-208.orig/src/core/service.c
+++ systemd-208/src/core/service.c
@@ -135,6 +135,7 @@ static void service_init(Unit *u) {
#ifdef HAVE_SYSV_COMPAT
s->sysv_start_priority = -1;
s->sysv_start_priority_from_rcnd = -1;
+ s->sysv_remain_after_exit_heuristic = true;
#endif
s->socket_fd = -1;
s->guess_main_pid = true;
@@ -883,6 +884,34 @@ static int service_load_sysv_path(Servic
free(short_description);
short_description = d;
+ } else if (startswith_no_case(t, "PIDFile:")) {
+ char *fn;
+
+ state = LSB;
+
+ fn = strstrip(t+8);
+ if (!path_is_absolute(fn)) {
+ log_warning("[%s:%u] PID file not absolute. Ignoring.", path, line);
+ continue;
+ }
+
+ if (!(fn = strdup(fn))) {
+ r = -ENOMEM;
+ goto finish;
+ }
+
+ free(s->pid_file);
+ s->pid_file = fn;
+ s->sysv_remain_after_exit_heuristic = false;
+ s->remain_after_exit = false;
+ } else if (startswith_no_case(t, "X-Systemd-RemainAfterExit:")) {
+ char *j;
+
+ state = LSB;
+ if ((j = strstrip(t+26)) && *j) {
+ s->remain_after_exit = parse_boolean(j);
+ s->sysv_remain_after_exit_heuristic = false;
+ }
} else if (state == LSB_DESCRIPTION) {
if (startswith(l, "#\t") || startswith(l, "# ")) {
@@ -933,7 +962,8 @@ static int service_load_sysv_path(Servic
/* Special setting for all SysV services */
s->type = SERVICE_FORKING;
- s->remain_after_exit = !s->pid_file;
+ if (s->sysv_remain_after_exit_heuristic)
+ s->remain_after_exit = !s->pid_file;
s->guess_main_pid = false;
s->restart = SERVICE_RESTART_NO;
s->exec_context.ignore_sigpipe = false;
@@ -2080,7 +2110,7 @@ static void service_enter_running(Servic
if ((main_pid_ok > 0 || (main_pid_ok < 0 && cgroup_ok != 0)) &&
(s->bus_name_good || s->type != SERVICE_DBUS)) {
#ifdef HAVE_SYSV_COMPAT
- if (s->sysv_enabled && !s->pid_file)
+ if (s->sysv_enabled && !s->pid_file && s->sysv_remain_after_exit_heuristic)
s->remain_after_exit = false;
#endif
service_set_state(s, SERVICE_RUNNING);
Index: systemd-208/src/core/service.h
===================================================================
--- systemd-208.orig/src/core/service.h
+++ systemd-208/src/core/service.h
@@ -178,6 +178,7 @@ struct Service {
bool is_sysv:1;
bool sysv_has_lsb:1;
bool sysv_enabled:1;
+ bool sysv_remain_after_exit_heuristic:1;
int sysv_start_priority_from_rcnd;
int sysv_start_priority;