X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=service.c;h=e5a9658bcfa7784edef26acb0cf17f917998c194;hb=6f4706b79e37754c83677e81396e783dde243b39;hp=3d840cbd92f9c3c8a1cfa53d9e8de01b2f41edb2;hpb=70123e68a04016efca9266fc22dd05a0a7fd2d51;p=elogind.git diff --git a/service.c b/service.c index 3d840cbd9..e5a9658bc 100644 --- a/service.c +++ b/service.c @@ -157,7 +157,10 @@ static int sysv_chkconfig_order(Service *s) { if (t->sysv_start_priority < 0) continue; - if (s->sysv_has_lsb && t->sysv_has_lsb) + /* If both units have modern headers we don't care + * about the priorities */ + if ((!s->sysv_path || s->sysv_has_lsb) && + (!t->sysv_path || t->sysv_has_lsb)) continue; if (t->sysv_start_priority < s->sysv_start_priority) @@ -839,7 +842,17 @@ static int service_load_pid_file(Service *s) { if ((unsigned long) (pid_t) p != p) return -ERANGE; - s->main_pid = p; + if (kill((pid_t) p, 0) < 0 && errno != EPERM) { + log_warning("PID %llu read from file %s does not exist. Your service or init script might be broken.", + (unsigned long long) p, s->pid_file); + return -ESRCH; + } + + if ((r = unit_watch_pid(UNIT(s), (pid_t) p)) < 0) + /* FIXME: we need to do something here */ + return r; + + s->main_pid = (pid_t) p; s->main_pid_known = true; return 0;