From: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Oct 2025 02:31:43 +0000 (+0000) Subject: Fix unchecked return codes for hts_settings_buildpath X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dbc39b421808a43b3bb7def7738f8c2db5209404;p=thirdparty%2Ftvheadend.git Fix unchecked return codes for hts_settings_buildpath Co-authored-by: Flole998 <9951871+Flole998@users.noreply.github.com> --- diff --git a/src/config.c b/src/config.c index d8000085b..5907ef21d 100644 --- a/src/config.c +++ b/src/config.c @@ -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 */ diff --git a/src/epggrab/module.c b/src/epggrab/module.c index e47c29c34..2634ce28c 100644 --- a/src/epggrab/module.c +++ b/src/epggrab/module.c @@ -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, diff --git a/src/epggrab/otamux.c b/src/epggrab/otamux.c index 0a5dc9345..aa9cf9af1 100644 --- a/src/epggrab/otamux.c +++ b/src/epggrab/otamux.c @@ -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);