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) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-08 08:28:22 +00:00
parent d277bfb657
commit 4ae68998ce
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C

View file

@ -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);