chiark / gitweb /
manager: turn a superfluous check into assert
authorMichal Schmidt <mschmidt@redhat.com>
Sat, 2 Mar 2013 11:44:41 +0000 (12:44 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Sat, 2 Mar 2013 11:57:42 +0000 (12:57 +0100)
The crash that the check prevented has been fixed by commit 9e9e2b7.

src/core/manager.c

index d976581c96bfa897bbc4cb60fd6d83e27b37ada3..91d773c2f6c9f1589e4adbcfd4c8b14bc4643e4d 100644 (file)
@@ -269,8 +269,9 @@ static void manager_print_jobs_in_progress(Manager *m) {
                 if (j->state == JOB_RUNNING && counter++ == print_nr)
                         break;
 
                 if (j->state == JOB_RUNNING && counter++ == print_nr)
                         break;
 
-       if (!j)
-               return;
+        /* m->n_running_jobs must be consistent with the contents of m->jobs,
+         * so the above loop must have succeeded in finding j. */
+        assert(counter == print_nr + 1);
 
         cylon_pos = m->jobs_in_progress_iteration % 14;
         if (cylon_pos >= 8)
 
         cylon_pos = m->jobs_in_progress_iteration % 14;
         if (cylon_pos >= 8)