]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
sched: exit with fatal message when there is nothing to do
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 30 Jun 2014 10:42:26 +0000 (12:42 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 30 Jun 2014 10:54:04 +0000 (12:54 +0200)
With cmdport 0 and port 0, it's now possible that there is no descriptor
watched or timer running, i.e. chronyd doing nothing and only waiting to
be terminated. Replace the assertion with LOG_FATAL to exit properly.

sched.c

diff --git a/sched.c b/sched.c
index 578c69c395d595c1732456914b25fbd54504ccad..60dcf32ca31387c23b973303df9d18a25d50095d 100644 (file)
--- a/sched.c
+++ b/sched.c
@@ -592,7 +592,9 @@ SCH_MainLoop(void)
 
     /* if there are no file descriptors being waited on and no
        timeout set, this is clearly ridiculous, so stop the run */
-    assert(ptv || n_read_fds);
+    if (!ptv && !n_read_fds) {
+      LOG_FATAL(LOGF_Scheduler, "Nothing to do");
+    }
 
     /* Copy current set of read file descriptors */
     memcpy((void *) &rd, (void *) &read_fds, sizeof(fd_set));