Skip to content

Conversation

@Ar2rL
Copy link
Contributor

@Ar2rL Ar2rL commented Jul 21, 2019

Do not allow some file operations to (re)use lfs_file_t stucture when file is already opened (prohibit open) or not opened/closed (prohibit all operations but open).
It is achieved by adding new internal file flag. This flag is set in lfs_file_open and it is reset in lfs_file_close. It is also tested in each (file related) API call as an ASSERTprecondition.
This is second attempt to add this functionality after discussion in pull request #213.

@geky
Copy link
Member

geky commented Jul 21, 2019

Oh hey, thanks for this! This looks perfect, I will merge it next chance I get 👍

Just to let you know, if you force-push to the same branch, GitHub will automatically update any PRs using that branch.

@geky
Copy link
Member

geky commented Jul 24, 2019

Just an FYI I also create a PR to change the rdonly/wronly asserts, these should be able to go in together. I created a separate PR so others would be able to see that this is changing if they are watching the repo.
#243

@geky geky merged commit 31e28fd into littlefs-project:master Jul 29, 2019
@geky
Copy link
Member

geky commented Jul 29, 2019

Just an FYI, I had to remove the assert in lfs_file_opencfg as it was causing CI to fail:
e249854

We unfortunately can't assume the initial value of the lfs_file_t struct in lfs_file_opencfg. But at least this is still useful for protecting against operations on closed files.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants