From c796b85f5c043d4b856f9d8c948fb6b152d0f930 Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Wed, 28 Jan 2026 18:14:24 +0530 Subject: [PATCH 1/8] RDKEMW-10995: Proper fd validation and avoid double-close --- rdkPlugins/Logging/source/FileSink.cpp | 95 ++++++++++++++++++++++---- rdkPlugins/Logging/source/FileSink.h | 3 +- 2 files changed, 83 insertions(+), 15 deletions(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index 4beb5fe6b..c38d86420 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -29,6 +29,7 @@ #include #include #include +#include /** * @brief A logging sink that sends the contents of the container stdout/err to a given file. The file @@ -41,7 +42,11 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr &containerConfig) : mContainerConfig(containerConfig), mContainerId(containerId), + mFileSizeLimit(SSIZE_MAX), + mOutputFileFd(-1), + mDevNullFd(-1), mLimitHit(false), + mClosed(false), mBuf{} { AI_LOG_FN_ENTRY(); @@ -71,13 +76,18 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr 0) + if (mDevNullFd >= 0) { mOutputFileFd = mDevNullFd; } @@ -88,19 +98,36 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr locker(mLock); + mClosed = true; + + devNullFdToClose = mDevNullFd; + outputFdToClose = mOutputFileFd; + mDevNullFd = -1; + mOutputFileFd = -1; } - if (mOutputFileFd > 0) + // Close everything we opened; avoid closing the same fd twice + if (outputFdToClose >= 0 && outputFdToClose != devNullFdToClose) { - if (close(mOutputFileFd) < 0) + if (close(outputFdToClose) < 0) { AI_LOG_SYS_ERROR(errno, "Failed to close output file"); } } + + if (devNullFdToClose >= 0) + { + if (close(devNullFdToClose) < 0) + { + AI_LOG_SYS_ERROR(errno, "Failed to close /dev/null"); + } + } } /** @@ -117,6 +144,11 @@ void FileSink::DumpLog(const int bufferFd) std::lock_guard locker(mLock); + if (mClosed) + { + return; + } + ssize_t ret; ssize_t offset = 0; @@ -134,9 +166,16 @@ void FileSink::DumpLog(const int bufferFd) if (offset <= mFileSizeLimit) { // Write to the output file - if (write(mOutputFileFd, mBuf, ret) < 0) + if (mOutputFileFd >= 0) { - AI_LOG_SYS_ERROR(errno, "Write failed"); + if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) + { + AI_LOG_SYS_ERROR(errno, "Write failed"); + if (mDevNullFd >= 0) + { + mOutputFileFd = mDevNullFd; + } + } } } else @@ -148,7 +187,10 @@ void FileSink::DumpLog(const int bufferFd) mContainerId.c_str(), mFileSizeLimit); } mLimitHit = true; - write(mDevNullFd, mBuf, ret); + if (mDevNullFd >= 0) + { + TEMP_FAILURE_RETRY(write(mDevNullFd, mBuf, ret)); + } } } @@ -158,7 +200,17 @@ void FileSink::DumpLog(const int bufferFd) if (!mLimitHit) { std::string marker = "---------------------------------------------\n"; - write(mOutputFileFd, marker.c_str(), marker.length()); + if (mOutputFileFd >= 0) + { + if (TEMP_FAILURE_RETRY(write(mOutputFileFd, marker.c_str(), marker.length())) < 0) + { + AI_LOG_SYS_ERROR(errno, "Write failed"); + if (mDevNullFd >= 0) + { + mOutputFileFd = mDevNullFd; + } + } + } } #endif } @@ -172,6 +224,11 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo { std::lock_guard locker(mLock); + if (mClosed) + { + return; + } + if (event.events & EPOLLIN) { ssize_t ret; @@ -199,9 +256,16 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo if (offset <= mFileSizeLimit) { // Write to the output file - if (write(mOutputFileFd, mBuf, ret) < 0) + if (mOutputFileFd >= 0) { - AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); + if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) + { + AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); + if (mDevNullFd >= 0) + { + mOutputFileFd = mDevNullFd; + } + } } } else @@ -213,7 +277,10 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo mContainerId.c_str(), mFileSizeLimit); } mLimitHit = true; - write(mDevNullFd, mBuf, ret); + if (mDevNullFd >= 0) + { + TEMP_FAILURE_RETRY(write(mDevNullFd, mBuf, ret)); + } } } @@ -264,4 +331,4 @@ int FileSink::openFile(const std::string &pathName) } return openedFd; -} \ No newline at end of file +} diff --git a/rdkPlugins/Logging/source/FileSink.h b/rdkPlugins/Logging/source/FileSink.h index 5a315fd03..6e2e8dc1d 100644 --- a/rdkPlugins/Logging/source/FileSink.h +++ b/rdkPlugins/Logging/source/FileSink.h @@ -46,7 +46,8 @@ class FileSink : public ILoggingSink int mDevNullFd; bool mLimitHit; + bool mClosed; char mBuf[PTY_BUFFER_SIZE]; std::mutex mLock; -}; \ No newline at end of file +}; From 8a64096f4b5095c3ab125126202179527242ba8e Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:29:07 +0530 Subject: [PATCH 2/8] RDKEMW-10995: Fix copilot review changes Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- rdkPlugins/Logging/source/FileSink.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index c38d86420..232df2dcb 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -80,6 +80,7 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr Date: Tue, 3 Feb 2026 11:29:44 +0530 Subject: [PATCH 3/8] RDKEMW-10995: Fix copilot review changes Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- rdkPlugins/Logging/source/FileSink.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index 232df2dcb..d583792ff 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -206,10 +206,16 @@ void FileSink::DumpLog(const int bufferFd) if (TEMP_FAILURE_RETRY(write(mOutputFileFd, marker.c_str(), marker.length())) < 0) { AI_LOG_SYS_ERROR(errno, "Write failed"); - if (mDevNullFd >= 0) + if (mDevNullFd >= 0 && mOutputFileFd != mDevNullFd) { + // Fall back to /dev/null if it's a different, valid fd mOutputFileFd = mDevNullFd; } + else + { + // Avoid repeatedly attempting writes on a failing fd + mOutputFileFd = -1; + } } } } From d207aae485aa34009e6dd4924c1c256451b18083 Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 11:30:10 +0530 Subject: [PATCH 4/8] RDKEMW-10995: Fix copilot review changes Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- rdkPlugins/Logging/source/FileSink.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index d583792ff..03ae5b939 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -268,10 +268,18 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) { AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); - if (mDevNullFd >= 0) + // If writing to the output file fails, attempt to fall back to /dev/null. + // Avoid repeatedly attempting writes to an already-failed descriptor. + if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) { mOutputFileFd = mDevNullFd; } + else + { + // Either we were already writing to /dev/null, or /dev/null is invalid; + // disable further writes from this sink. + mOutputFileFd = -1; + } } } } From 7cc605ad258908163cc3dfd9fe643a864a798b45 Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 13:42:28 +0530 Subject: [PATCH 5/8] RDKEMW-10995: Fix copilot review changes --- rdkPlugins/Logging/source/FileSink.cpp | 38 +++++++++++++++++--------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index 03ae5b939..8a6fa0584 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -75,23 +75,23 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr= 0) + { + mOutputFileFd = mDevNullFd; + } + } } else { // Config says "log to file" but file options are missing; default to /dev/null AI_LOG_WARN("No file options provided for container log; sending output to /dev/null"); - mOutputFilePath = "/dev/null"; - } - - mOutputFileFd = openFile(mOutputFilePath); - if (mOutputFileFd < 0) - { - // Couldn't open our output file, send to /dev/null to avoid blocking - AI_LOG_SYS_ERROR(errno, "Failed to open container logfile - sending to /dev/null"); - if (mDevNullFd >= 0) - { - mOutputFileFd = mDevNullFd; - } + mOutputFileFd = mDevNullFd; } AI_LOG_FN_EXIT(); @@ -172,10 +172,18 @@ void FileSink::DumpLog(const int bufferFd) if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) { AI_LOG_SYS_ERROR(errno, "Write failed"); - if (mDevNullFd >= 0) + if (mDevNullFd >= 0 && mOutputFileFd != mDevNullFd) { + if (close(mOutputFileFd) < 0) + { + AI_LOG_SYS_ERROR(errno, "Failed to close output file"); + } mOutputFileFd = mDevNullFd; } + else + { + mOutputFileFd = -1; + } } } } @@ -272,6 +280,10 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo // Avoid repeatedly attempting writes to an already-failed descriptor. if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) { + if (close(mOutputFileFd) < 0) + { + AI_LOG_SYS_ERROR(errno, "Failed to close output file"); + } mOutputFileFd = mDevNullFd; } else From cb4937925cafac32da8add8c0fec62aeb556d929 Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 14:42:01 +0530 Subject: [PATCH 6/8] RDKEMW-10995: Fix copilot review changes --- rdkPlugins/Logging/source/FileSink.cpp | 109 +++++++++++++------------ 1 file changed, 59 insertions(+), 50 deletions(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index 8a6fa0584..ab0088fa7 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -75,23 +75,23 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr= 0) - { - mOutputFileFd = mDevNullFd; - } - } } else { // Config says "log to file" but file options are missing; default to /dev/null AI_LOG_WARN("No file options provided for container log; sending output to /dev/null"); - mOutputFileFd = mDevNullFd; + mOutputFilePath = "/dev/null"; + } + + mOutputFileFd = openFile(mOutputFilePath); + if (mOutputFileFd < 0) + { + // Couldn't open our output file, send to /dev/null to avoid blocking + AI_LOG_SYS_ERROR(errno, "Failed to open container logfile - sending to /dev/null"); + if (mDevNullFd >= 0) + { + mOutputFileFd = mDevNullFd; + } } AI_LOG_FN_EXIT(); @@ -171,19 +171,32 @@ void FileSink::DumpLog(const int bufferFd) { if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) { - AI_LOG_SYS_ERROR(errno, "Write failed"); - if (mDevNullFd >= 0 && mOutputFileFd != mDevNullFd) + AI_LOG_SYS_ERROR(errno, "Write failed to fd %d", mOutputFileFd); + + // Handle persistent errors that require fallback + if (errno == EBADF || errno == EPIPE || errno == ENOSPC || errno == EIO) { - if (close(mOutputFileFd) < 0) + if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) { - AI_LOG_SYS_ERROR(errno, "Failed to close output file"); + // Fall back to /dev/null if it's a different, valid fd + AI_LOG_WARN("Switching to /dev/null for container %s", mContainerId.c_str()); + mOutputFileFd = mDevNullFd; + } + else if (mOutputFileFd == mDevNullFd) + { + // Already writing to /dev/null and that failed + AI_LOG_ERROR("Write to /dev/null failed - disabling logging for container %s", + mContainerId.c_str()); + mOutputFileFd = -1; + } + else + { + AI_LOG_ERROR("Cannot switch logging for container %s to /dev/null: invalid fd %d", + mContainerId.c_str(), mDevNullFd); + mOutputFileFd = -1; } - mOutputFileFd = mDevNullFd; - } - else - { - mOutputFileFd = -1; } + // Note: EINTR is handled by TEMP_FAILURE_RETRY } } } @@ -204,27 +217,15 @@ void FileSink::DumpLog(const int bufferFd) } #if (AI_BUILD_TYPE == AI_DEBUG) - // Separate sections of log file for reabability + // Separate sections of log file for readability // (useful if we're writing lots of buffer dumps) - if (!mLimitHit) + if (!mLimitHit && mOutputFileFd >= 0) { std::string marker = "---------------------------------------------\n"; - if (mOutputFileFd >= 0) + if (TEMP_FAILURE_RETRY(write(mOutputFileFd, marker.c_str(), marker.length())) < 0) { - if (TEMP_FAILURE_RETRY(write(mOutputFileFd, marker.c_str(), marker.length())) < 0) - { - AI_LOG_SYS_ERROR(errno, "Write failed"); - if (mDevNullFd >= 0 && mOutputFileFd != mDevNullFd) - { - // Fall back to /dev/null if it's a different, valid fd - mOutputFileFd = mDevNullFd; - } - else - { - // Avoid repeatedly attempting writes on a failing fd - mOutputFileFd = -1; - } - } + // Silent failure acceptable for debug marker, but handle gracefully + AI_LOG_SYS_ERROR(errno, "Failed to write debug marker"); } } #endif @@ -276,21 +277,29 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) { AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); - // If writing to the output file fails, attempt to fall back to /dev/null. - // Avoid repeatedly attempting writes to an already-failed descriptor. - if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) + + // Handle persistent errors that require fallback + if (errno == EBADF || errno == EPIPE || errno == ENOSPC || errno == EIO) { - if (close(mOutputFileFd) < 0) + if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) { - AI_LOG_SYS_ERROR(errno, "Failed to close output file"); + // Fall back to /dev/null if it's a different, valid fd + AI_LOG_WARN("Switching to /dev/null for container %s", mContainerId.c_str()); + mOutputFileFd = mDevNullFd; + } + else if (mOutputFileFd == mDevNullFd) + { + // Already writing to /dev/null and that failed + AI_LOG_ERROR("Write to /dev/null failed - disabling logging for container %s", + mContainerId.c_str()); + mOutputFileFd = -1; + } + else + { + AI_LOG_ERROR("Cannot switch logging for container %s to /dev/null: invalid fd %d", + mContainerId.c_str(), mDevNullFd); + mOutputFileFd = -1; } - mOutputFileFd = mDevNullFd; - } - else - { - // Either we were already writing to /dev/null, or /dev/null is invalid; - // disable further writes from this sink. - mOutputFileFd = -1; } } } From 233f87260e5945f4ee5f9cd2ead15c7d6035a7b9 Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:25:40 +0530 Subject: [PATCH 7/8] RDKEMW-10995: Proper fd validation --- rdkPlugins/Logging/source/FileSink.cpp | 126 +++---------------------- 1 file changed, 13 insertions(+), 113 deletions(-) diff --git a/rdkPlugins/Logging/source/FileSink.cpp b/rdkPlugins/Logging/source/FileSink.cpp index ab0088fa7..44dec051e 100644 --- a/rdkPlugins/Logging/source/FileSink.cpp +++ b/rdkPlugins/Logging/source/FileSink.cpp @@ -29,7 +29,6 @@ #include #include #include -#include /** * @brief A logging sink that sends the contents of the container stdout/err to a given file. The file @@ -42,11 +41,7 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr &containerConfig) : mContainerConfig(containerConfig), mContainerId(containerId), - mFileSizeLimit(SSIZE_MAX), - mOutputFileFd(-1), - mDevNullFd(-1), mLimitHit(false), - mClosed(false), mBuf{} { AI_LOG_FN_ENTRY(); @@ -76,12 +71,6 @@ FileSink::FileSink(const std::string &containerId, std::shared_ptr locker(mLock); - mClosed = true; - - devNullFdToClose = mDevNullFd; - outputFdToClose = mOutputFileFd; - mDevNullFd = -1; - mOutputFileFd = -1; - } - // Close everything we opened; avoid closing the same fd twice - if (outputFdToClose >= 0 && outputFdToClose != devNullFdToClose) + if (mOutputFileFd >= 0 && mOutputFileFd != mDevNullFd) { - if (close(outputFdToClose) < 0) + if (close(mOutputFileFd) < 0) { AI_LOG_SYS_ERROR(errno, "Failed to close output file"); } } - if (devNullFdToClose >= 0) + if (mDevNullFd >= 0) { - if (close(devNullFdToClose) < 0) + if (close(mDevNullFd) < 0) { AI_LOG_SYS_ERROR(errno, "Failed to close /dev/null"); } @@ -145,11 +120,6 @@ void FileSink::DumpLog(const int bufferFd) std::lock_guard locker(mLock); - if (mClosed) - { - return; - } - ssize_t ret; ssize_t offset = 0; @@ -167,37 +137,9 @@ void FileSink::DumpLog(const int bufferFd) if (offset <= mFileSizeLimit) { // Write to the output file - if (mOutputFileFd >= 0) + if (write(mOutputFileFd, mBuf, ret) < 0) { - if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) - { - AI_LOG_SYS_ERROR(errno, "Write failed to fd %d", mOutputFileFd); - - // Handle persistent errors that require fallback - if (errno == EBADF || errno == EPIPE || errno == ENOSPC || errno == EIO) - { - if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) - { - // Fall back to /dev/null if it's a different, valid fd - AI_LOG_WARN("Switching to /dev/null for container %s", mContainerId.c_str()); - mOutputFileFd = mDevNullFd; - } - else if (mOutputFileFd == mDevNullFd) - { - // Already writing to /dev/null and that failed - AI_LOG_ERROR("Write to /dev/null failed - disabling logging for container %s", - mContainerId.c_str()); - mOutputFileFd = -1; - } - else - { - AI_LOG_ERROR("Cannot switch logging for container %s to /dev/null: invalid fd %d", - mContainerId.c_str(), mDevNullFd); - mOutputFileFd = -1; - } - } - // Note: EINTR is handled by TEMP_FAILURE_RETRY - } + AI_LOG_SYS_ERROR(errno, "Write failed"); } } else @@ -209,24 +151,17 @@ void FileSink::DumpLog(const int bufferFd) mContainerId.c_str(), mFileSizeLimit); } mLimitHit = true; - if (mDevNullFd >= 0) - { - TEMP_FAILURE_RETRY(write(mDevNullFd, mBuf, ret)); - } + write(mDevNullFd, mBuf, ret); } } #if (AI_BUILD_TYPE == AI_DEBUG) - // Separate sections of log file for readability + // Separate sections of log file for reabability // (useful if we're writing lots of buffer dumps) - if (!mLimitHit && mOutputFileFd >= 0) + if (!mLimitHit) { std::string marker = "---------------------------------------------\n"; - if (TEMP_FAILURE_RETRY(write(mOutputFileFd, marker.c_str(), marker.length())) < 0) - { - // Silent failure acceptable for debug marker, but handle gracefully - AI_LOG_SYS_ERROR(errno, "Failed to write debug marker"); - } + write(mOutputFileFd, marker.c_str(), marker.length()); } #endif } @@ -240,11 +175,6 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo { std::lock_guard locker(mLock); - if (mClosed) - { - return; - } - if (event.events & EPOLLIN) { ssize_t ret; @@ -272,36 +202,9 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo if (offset <= mFileSizeLimit) { // Write to the output file - if (mOutputFileFd >= 0) + if (write(mOutputFileFd, mBuf, ret) < 0) { - if (TEMP_FAILURE_RETRY(write(mOutputFileFd, mBuf, ret)) < 0) - { - AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); - - // Handle persistent errors that require fallback - if (errno == EBADF || errno == EPIPE || errno == ENOSPC || errno == EIO) - { - if (mOutputFileFd != mDevNullFd && mDevNullFd >= 0) - { - // Fall back to /dev/null if it's a different, valid fd - AI_LOG_WARN("Switching to /dev/null for container %s", mContainerId.c_str()); - mOutputFileFd = mDevNullFd; - } - else if (mOutputFileFd == mDevNullFd) - { - // Already writing to /dev/null and that failed - AI_LOG_ERROR("Write to /dev/null failed - disabling logging for container %s", - mContainerId.c_str()); - mOutputFileFd = -1; - } - else - { - AI_LOG_ERROR("Cannot switch logging for container %s to /dev/null: invalid fd %d", - mContainerId.c_str(), mDevNullFd); - mOutputFileFd = -1; - } - } - } + AI_LOG_SYS_ERROR(errno, "Write to %s failed", mOutputFilePath.c_str()); } } else @@ -313,10 +216,7 @@ void FileSink::process(const std::shared_ptr &pollLoop, epo mContainerId.c_str(), mFileSizeLimit); } mLimitHit = true; - if (mDevNullFd >= 0) - { - TEMP_FAILURE_RETRY(write(mDevNullFd, mBuf, ret)); - } + write(mDevNullFd, mBuf, ret); } } From 20cc80549ca5a825993cdfcdef722f573500c1cd Mon Sep 17 00:00:00 2001 From: Karthick Swaminathan <85346280+ks734@users.noreply.github.com> Date: Tue, 3 Feb 2026 15:28:45 +0530 Subject: [PATCH 8/8] Update FileSink.h --- rdkPlugins/Logging/source/FileSink.h | 1 - 1 file changed, 1 deletion(-) diff --git a/rdkPlugins/Logging/source/FileSink.h b/rdkPlugins/Logging/source/FileSink.h index 6e2e8dc1d..35ab25034 100644 --- a/rdkPlugins/Logging/source/FileSink.h +++ b/rdkPlugins/Logging/source/FileSink.h @@ -46,7 +46,6 @@ class FileSink : public ILoggingSink int mDevNullFd; bool mLimitHit; - bool mClosed; char mBuf[PTY_BUFFER_SIZE]; std::mutex mLock;