mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-17 22:19:57 -04:00
Leave rtss-profile.txt alone when it is there but does not read, so the lines of other executables in the folder stay.
The review found that rtss_limit.c state_put took a state file plat_file_read could not read for a missing one: a file another program held open (a scan) was rewritten with this profile's line alone, or deleted when the run removed its line, and the lines of other executables that share the folder (dev or probe builds) were lost. state_put now returns 0 when the read gave nothing but plat_file_size finds the file with bytes in it; the run then goes on as with a file that cannot be written (one log line, and a crash puts the profile back as an orderly exit does). An empty file is still rewritten. tests/rtss_worker_check.c state_locked checks a file holding another executable's line that does not read: the run limits as before, logs it, and the file stays as it was through the exit. Not reproduced before the change. Checks that passed: tests/rtss_limit_check.py, pass_cc_check.py --wall on rtss_limit.c, tools/check_content.py --staged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,9 @@ static int state_put(const RtssSaved *r) {
|
||||
if (state_off || !*state_path) return 0;
|
||||
uint64_t n = 0;
|
||||
char *text = (char *)plat_file_read(state_path, &n);
|
||||
// a file that is there but did not read (another program holds it, a scan) keeps the lines of the other executables
|
||||
// in the folder: rewritten from nothing, they would go
|
||||
if (!text && plat_file_size(state_path) > 0) return 0;
|
||||
size_t cap = (size_t)(text ? n : 0) + sizeof RTSS_SAVED_HEADER + 2 * (RTSS_NAME_MAX + 96);
|
||||
char *out = malloc(cap);
|
||||
int records = 0, ok = 0;
|
||||
|
||||
Reference in New Issue
Block a user