diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..253e57a --- /dev/null +++ b/.gitignore @@ -0,0 +1,24 @@ +# Build artifacts +Makefile.in +aclocal.m4 +autom4te.cache/ +compile +config.guess +config.log +config.status +config.sub +configure +depcomp +install-sh +ltmain.sh +missing +*.in +config.h.in +.deps/ +.libs/ +*.o +*.lo +*.la +*.a +*.so +*.so.* diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/rfcMgr/rfc_xconf_handler.cpp b/rfcMgr/rfc_xconf_handler.cpp index 1210bbc..87576fa 100644 --- a/rfcMgr/rfc_xconf_handler.cpp +++ b/rfcMgr/rfc_xconf_handler.cpp @@ -31,6 +31,8 @@ #include #endif #include +#include +#include #ifdef __cplusplus extern "C" { @@ -1507,8 +1509,17 @@ bool RuntimeFeatureControlProcessor::IsDirectBlocked() else { RDK_LOG(RDK_LOG_INFO, LOG_RFCMGR,"[%s][%d] RFC: Last direct failed blocking has expired, removing %s, allowing direct \n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME); - // Attempt to remove the file - if it fails (e.g., already removed), it's not critical - (void)remove(DIRECT_BLOCK_FILENAME); + // Attempt to remove the file - check errno to distinguish expected vs unexpected failures + if (remove(DIRECT_BLOCK_FILENAME) != 0) { + int err = errno; + if (err == ENOENT) { + // File already removed (race condition) - this is expected and not an error + RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] RFC: %s already removed (expected race condition)\n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME); + } else { + // Unexpected error (e.g., permission denied) + RDK_LOG(RDK_LOG_DEBUG, LOG_RFCMGR,"[%s][%d] RFC: Failed to remove %s, errno=%d (%s)\n", __FUNCTION__, __LINE__, DIRECT_BLOCK_FILENAME, err, strerror(err)); + } + } } } #endif