From 4ae68998ce7493cde9804d211ffde322a98d7ced Mon Sep 17 00:00:00 2001 From: Rongsong Shen Date: Thu, 8 Oct 2026 08:28:22 +0000 Subject: [PATCH] test(scheduler): silence snprintf truncation warning in repl trace baseline cleanup remove_workdir() now checks snprintf's result and skips a truncated path instead of unlinking whatever it happens to name. Co-Authored-By: Claude Opus 5.5 (1M context) --- src/scheduler/testsuite/test_repl_trace_baseline.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/scheduler/testsuite/test_repl_trace_baseline.c b/src/scheduler/testsuite/test_repl_trace_baseline.c index 37b56782..7e500971 100644 --- a/src/scheduler/testsuite/test_repl_trace_baseline.c +++ b/src/scheduler/testsuite/test_repl_trace_baseline.c @@ -902,7 +902,12 @@ static void remove_workdir(void) return; } for (i = 0; i < sizeof(names) / sizeof(names[0]); i++) { - snprintf(path, sizeof(path), "%s/%s", g_workdir, names[i]); + int n = snprintf(path, sizeof(path), "%s/%s", g_workdir, names[i]); + + /* A truncated path names some other file: leave it alone. */ + if ((n < 0) || ((size_t)n >= sizeof(path))) { + continue; + } unlink(path); } rmdir(g_workdir);