From 27eae4f05b3286dba6be16bfb6028293cff6b4f2 Mon Sep 17 00:00:00 2001 From: Saranya Date: Mon, 3 Nov 2025 13:44:41 +0000 Subject: [PATCH] RDKB-61859 : Replace syscfg system call with utopia API Replacing fopen with syscfg_get function --- utils/Makefile.am | 1 + utils/common_device_api.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/utils/Makefile.am b/utils/Makefile.am index c7ea47b6..626fb7dc 100644 --- a/utils/Makefile.am +++ b/utils/Makefile.am @@ -19,6 +19,7 @@ AM_CFLAGS = -D_ANSC_LINUX AM_CFLAGS += -D_ANSC_USER AM_CFLAGS += -D_ANSC_LITTLE_ENDIAN_ AM_CFLAGS += -Wall -Werror $(CFLAGS) +AM_CFLAGS += -I${STAGING_INCDIR}/syscfg lib_LTLIBRARIES = libfwutils.la libfwutils_la_SOURCES = rdk_fwdl_utils.c \ diff --git a/utils/common_device_api.c b/utils/common_device_api.c index 520323ed..21d9b5d1 100644 --- a/utils/common_device_api.c +++ b/utils/common_device_api.c @@ -18,6 +18,7 @@ #include "common_device_api.h" #include "rdkv_cdl_log_wrapper.h" +#include #define PARTNERID_INFO_FILE "/tmp/partnerId.out" @@ -132,11 +133,10 @@ size_t GetPartnerId( char *pPartnerId, size_t szBufSize ) fgets( pPartnerId, szBufSize, fp ); fclose( fp ); } - else if( (fp = popen( "syscfg get PartnerID", "r" )) != NULL ) + else if (syscfg_get(NULL, "PartnerID", buffer, sizeof(buffer)) == 0) { - fgets( pPartnerId, szBufSize, fp ); - pclose( fp ); - } + snprintf(pPartnerId, szBufSize, "%s", buffer); + } else { snprintf( pPartnerId, szBufSize, "comcast" );