projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
70123e6
)
service: verify PID is valid when reading it from PID file
author
Lennart Poettering
<lennart@poettering.net>
Thu, 8 Apr 2010 01:48:52 +0000
(
03:48
+0200)
committer
Lennart Poettering
<lennart@poettering.net>
Thu, 8 Apr 2010 01:48:52 +0000
(
03:48
+0200)
service.c
patch
|
blob
|
history
diff --git
a/service.c
b/service.c
index
3d840cb
..
832c7b3
100644
(file)
--- a/
service.c
+++ b/
service.c
@@
-839,7
+839,13
@@
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;
+ }
+
+ s->main_pid = (pid_t) p;
s->main_pid_known = true;
return 0;