]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
Fix unchecked return codes for hts_settings_buildpath
authorcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Tue, 14 Oct 2025 02:31:43 +0000 (02:31 +0000)
committerFlole <Flole998@users.noreply.github.com>
Sat, 25 Oct 2025 14:09:53 +0000 (16:09 +0200)
Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com>
src/config.c
src/epggrab/module.c
src/epggrab/otamux.c

index d8000085b06e188b5b26b2b21fc2113c8c237f64..5907ef21d054cf0510fdcae6c8b24b2732809353 100644 (file)
@@ -517,11 +517,11 @@ config_migrate_v2 ( void )
     htsmsg_destroy(m);
 
     /* Move muxes */
-    hts_settings_buildpath(src, sizeof(src),
-                           "input/iptv/muxes");
-    hts_settings_buildpath(dst, sizeof(dst),
-                           "input/iptv/networks/%s/muxes", ubuf);
-    rename(src, dst);
+    if (!hts_settings_buildpath(src, sizeof(src),
+                                "input/iptv/muxes") &&
+        !hts_settings_buildpath(dst, sizeof(dst),
+                                "input/iptv/networks/%s/muxes", ubuf))
+      rename(src, dst);
   }
 }
 
@@ -534,14 +534,16 @@ config_migrate_v3 ( void )
   char src[1024], dst[1024];
 
   /* Due to having to potentially run this twice! */
-  hts_settings_buildpath(dst, sizeof(dst), "input/dvb/networks");
+  if (hts_settings_buildpath(dst, sizeof(dst), "input/dvb/networks"))
+    return;
   if (!access(dst, R_OK | W_OK))
     return;
 
   if (hts_settings_makedirs(dst))
     return;
 
-  hts_settings_buildpath(src, sizeof(src), "input/linuxdvb/networks");
+  if (hts_settings_buildpath(src, sizeof(src), "input/linuxdvb/networks"))
+    return;
   rename(src, dst);
 }
 
@@ -1822,7 +1824,8 @@ config_boot
   hts_settings_init(config.confdir);
 
   /* Lock it */
-  hts_settings_buildpath(config_lock, sizeof(config_lock), ".lock");
+  if (hts_settings_buildpath(config_lock, sizeof(config_lock), ".lock"))
+    exit(78); /* config error */
   if ((config_lock_fd = file_lock(config_lock, 3)) < 0)
     exit(78); /* config error */
 
index e47c29c34a18c637d07a878109243ef99a2ff5b1..2634ce28c06b1eccd5fd84a2dcb293d609e87b47 100644 (file)
@@ -708,7 +708,8 @@ epggrab_module_ext_t *epggrab_module_ext_create
   atomic_set(&skel->sock, -1);
 
   /* Pass through */
-  hts_settings_buildpath(path, sizeof(path), "epggrab/%s.sock", sockid);
+  if (hts_settings_buildpath(path, sizeof(path), "epggrab/%s.sock", sockid))
+    path[0] = '\0';
   epggrab_module_int_create((epggrab_module_int_t*)skel,
                             cls ?: &epggrab_mod_ext_class,
                             id, subsys, saveid, name, priority, path,
index 0a5dc9345de42110f0d2ad01bd5b0bc02d5bd2c4..aa9cf9af1df794a088a78b580ebd6b1755bfed88 100644 (file)
@@ -936,10 +936,10 @@ epggrab_ota_init ( void )
   mpegts_add_listener(&ml);
 
   /* Delete old config */
-  hts_settings_buildpath(path, sizeof(path), "epggrab/otamux");
-  if (!lstat(path, &st))
-    if (!S_ISDIR(st.st_mode))
-      hts_settings_remove("epggrab/otamux");
+  if (!hts_settings_buildpath(path, sizeof(path), "epggrab/otamux"))
+    if (!lstat(path, &st))
+      if (!S_ISDIR(st.st_mode))
+        hts_settings_remove("epggrab/otamux");
 
   atomic_set(&epggrab_ota_running, 1);