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:
parent
d277bfb657
commit
4ae68998ce
1 changed files with 6 additions and 1 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue