commit:     710c874e6e3bc57b1561eb8f2108244bf24ed32e
Author:     Zac Medico <zmedico <AT> gmail <DOT> com>
AuthorDate: Sat Oct 13 19:32:45 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Oct 15 16:50:42 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=710c874e

supervise-daemon: fix respawn_max off by one

Fix the comparison between respawn_count and respawn_max so that
respawn_max = 1 will allow for one respawn. Since respawn_count is
incremented before the comparison, use a 'greater than' comparison
so that respawn will be triggered when respawn_count is equal to
respawn_max.

Fixes: https://github.com/OpenRC/openrc/issues/247
Fixes: https://github.com/OpenRC/openrc/issues/248

 src/rc/supervise-daemon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 4e3d22c4..27089152 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -510,7 +510,7 @@ static void supervisor(char *exec, char **argv)
                                        first_spawn = 0;
                                } else
                                        respawn_count++;
-                               if (respawn_count >= respawn_max) {
+                               if (respawn_count > respawn_max) {
                                        syslog(LOG_WARNING,
                                                        "respawned \"%s\" too 
many times, exiting", exec);
                                        exiting = true;

Reply via email to