You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2026/09/12 20:53:07 UTC
(celix) branch feature/update-gh-workflow-ubuntu updated: Fix vfprintf issue with for the new format-overflow warning
This is an automated email from the ASF dual-hosted git repository.
pnoltes pushed a commit to branch feature/update-gh-workflow-ubuntu
in repository https://gitbox.apache.org/repos/asf/celix.git
The following commit(s) were added to refs/heads/feature/update-gh-workflow-ubuntu by this push:
new 160b79037 Fix vfprintf issue with for the new format-overflow warning
160b79037 is described below
commit 160b790374e6ea5e8251b0886611e82ac4067d6a
Author: Pepijn Noltes <pn...@apache.org>
AuthorDate: Sat Sep 12 22:51:40 2026 +0200
Fix vfprintf issue with for the new format-overflow warning
---
bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc | 7 ++++---
bundles/logging/log_helper/gtest/src/LogHelperTestSuite.cc | 6 ++++--
conanfile.py | 2 +-
libs/framework/gtest/src/ScheduledEventTestSuite.cc | 6 ++++--
libs/utils/src/celix_log_utils.c | 2 +-
5 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
index 4e94ff11f..6f192c6e6 100644
--- a/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
+++ b/bundles/logging/log_admin/gtest/src/LogAdminTestSuite.cc
@@ -290,9 +290,10 @@ static void logSinkFunction(void *handle, celix_log_level_e level, long logServi
EXPECT_STREQ("test::Log1", logServiceName);
}
- vfprintf(stdout, format, formatArgs);
-
- fprintf(stdout, "\n");
+ if (format) {
+ vfprintf(stdout, format, formatArgs);
+ fprintf(stdout, "\n");
+ }
}
TEST_F(LogBundleTestSuite, LogServiceAndSink) {
diff --git a/bundles/logging/log_helper/gtest/src/LogHelperTestSuite.cc b/bundles/logging/log_helper/gtest/src/LogHelperTestSuite.cc
index 0bf6dbcb5..a4ff350cb 100644
--- a/bundles/logging/log_helper/gtest/src/LogHelperTestSuite.cc
+++ b/bundles/logging/log_helper/gtest/src/LogHelperTestSuite.cc
@@ -69,8 +69,10 @@ TEST_F(LogHelperTestSuite, LogToLogSvc) {
logSvc.vlogDetails= [](void *handle, celix_log_level_e, const char*, const char*, int, const char *format, va_list formatArgs) {
auto* c = static_cast<std::atomic<size_t>*>(handle);
c->fetch_add(1);
- vfprintf(stderr, format, formatArgs);
- fprintf(stderr, "\n");
+ if (format) {
+ vfprintf(stderr, format, formatArgs);
+ fprintf(stderr, "\n");
+ }
};
auto* props = celix_properties_create();
diff --git a/conanfile.py b/conanfile.py
index 02fb33da2..56402a90e 100644
--- a/conanfile.py
+++ b/conanfile.py
@@ -222,7 +222,7 @@ class CelixConan(ConanFile):
if self.options.enable_testing:
self.test_requires("gtest/1.17.0")
if self.options.enable_ccache:
- self.build_requires("ccache/4.7.4")
+ self.build_requires("ccache/[>=4.8 <=4.10.2]")
if self.options.enable_benchmarking:
self.test_requires("benchmark/[>=1.6.2]")
diff --git a/libs/framework/gtest/src/ScheduledEventTestSuite.cc b/libs/framework/gtest/src/ScheduledEventTestSuite.cc
index f2dd53f55..5edbac427 100644
--- a/libs/framework/gtest/src/ScheduledEventTestSuite.cc
+++ b/libs/framework/gtest/src/ScheduledEventTestSuite.cc
@@ -720,8 +720,10 @@ TEST_F(ScheduledEventTestSuite, ScheduledEventTimeoutLogTest) {
output = stderr;
}
fprintf(output, "%s: ", celix_logLevel_toString(level));
- vfprintf(output, format, args);
- fprintf(output, "\n");
+ if (format) {
+ vfprintf(output, format, args);
+ fprintf(output, "\n");
+ }
};
celix_framework_setLogCallback(fw->getCFramework(), &logCount, logCallback);
diff --git a/libs/utils/src/celix_log_utils.c b/libs/utils/src/celix_log_utils.c
index 51f4861df..238bfc622 100644
--- a/libs/utils/src/celix_log_utils.c
+++ b/libs/utils/src/celix_log_utils.c
@@ -86,7 +86,7 @@ void celix_logUtils_vLogToStdout(const char *logName, celix_log_level_e level, c
static pthread_mutex_t globalMutex = PTHREAD_MUTEX_INITIALIZER;
void celix_logUtils_vLogToStdoutDetails(const char *logName, celix_log_level_e level, const char* file, const char* function, int line, const char *format, va_list formatArgs) {
- if (level == CELIX_LOG_LEVEL_DISABLED) {
+ if (format == NULL || level == CELIX_LOG_LEVEL_DISABLED) {
//silently ignore
return;
}