Skip to content

PR 5040-Potential DB file corruption on longer then shorter re-save DB file#5041

Open
bitWarrior wants to merge 3 commits intonasa:develfrom
bitWarrior:PR-5040
Open

PR 5040-Potential DB file corruption on longer then shorter re-save DB file#5041
bitWarrior wants to merge 3 commits intonasa:develfrom
bitWarrior:PR-5040

Conversation

@bitWarrior
Copy link
Copy Markdown
Collaborator

5040
Has Unit Tests (Y)
Documentation Included (N)
Generative AI was used in this contribution (Y)

Change Description

Changed the open() call PrmDbImpl::PRM_SAVE_FILE_cmdHandler to use OPEN_CREATE with the OVERWRITE flag, which maps to O_WRONLY | O_CREAT | O_TRUNC on POSIX. This will overwrite all stale data from any previous save and ensures only the new prm data is saved into the file.

Rationale

Fixes issue where old stale data from a larger file size could corrupt the current save.

Testing/Review Recommendations

Run new unit test. Create a larger then smaller prm file.

Future Work

N/A

AI Usage (see policy)

AI was used to create the new unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant