1 |
commit: 93c8cbe68428dcf7823a6483d30698ba001f4271 |
2 |
Author: Zac Medico <zmedico <AT> gmail <DOT> com> |
3 |
AuthorDate: Sat Oct 13 19:32:45 2018 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Oct 19 21:01:07 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=93c8cbe6 |
7 |
|
8 |
supervise-daemon: fix respawn_max off by one |
9 |
|
10 |
Fix the comparison between respawn_count and respawn_max so that |
11 |
respawn_max = 1 will allow for one respawn. Since respawn_count is |
12 |
incremented before the comparison, use a 'greater than' comparison |
13 |
so that respawn will be triggered when respawn_count is equal to |
14 |
respawn_max. |
15 |
|
16 |
Fixes: https://github.com/OpenRC/openrc/issues/247 |
17 |
Fixes: https://github.com/OpenRC/openrc/issues/248 |
18 |
|
19 |
src/rc/supervise-daemon.c | 2 +- |
20 |
1 file changed, 1 insertion(+), 1 deletion(-) |
21 |
|
22 |
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c |
23 |
index 8d56b8d4..e5e817d1 100644 |
24 |
--- a/src/rc/supervise-daemon.c |
25 |
+++ b/src/rc/supervise-daemon.c |
26 |
@@ -507,7 +507,7 @@ static void supervisor(char *exec, char **argv) |
27 |
first_spawn = 0; |
28 |
} else |
29 |
respawn_count++; |
30 |
- if (respawn_count >= respawn_max) { |
31 |
+ if (respawn_count > respawn_max) { |
32 |
syslog(LOG_WARNING, |
33 |
"respawned \"%s\" too many times, exiting", exec); |
34 |
exiting = true; |