]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Coverity CID 552897
authorDeltaMikeCharlie <127641886+DeltaMikeCharlie@users.noreply.github.com>
Tue, 3 Jun 2025 21:21:08 +0000 (07:21 +1000)
committerFlole <Flole998@users.noreply.github.com>
Wed, 4 Jun 2025 00:08:55 +0000 (02:08 +0200)
src/epggrab.c

index 20a1edddb845a18db320210e9fae492944f5e348..2ce352f0495c8066f9b9279f03b913f6cb367fd8 100644 (file)
@@ -516,17 +516,21 @@ time_t epggrab_get_next_int(void)
 {
   time_t ret_time;
   struct timespec current_time;
-  
+
   clock_gettime(CLOCK_REALTIME, &current_time);
-  if(!cron_multi_next(epggrab_cron_multi, current_time.tv_sec, &ret_time))
-  {
-    return ret_time;
-  }
-  else
+
+  tvh_mutex_lock(&epggrab_mutex);
+
+  if(cron_multi_next(epggrab_cron_multi, current_time.tv_sec, &ret_time))  //Zero means success
   {
-    return 0;
+    ret_time = 0;   //Reset to zero in case it was set to garbage during failure.
   }
-}
+  
+  tvh_mutex_unlock(&epggrab_mutex);
+
+  return ret_time;
+
+}//END function
 
 /* **************************************************************************
  * Count the number of EPG grabbers of a specified type