-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
pkg/fatfs/fatfs_vfs: fix flag translation in _open #14175
pkg/fatfs/fatfs_vfs: fix flag translation in _open #14175
Conversation
I ran the new test on before
with this patch
→ |
9ee6680
to
1ba1133
Compare
dee5d69
to
1715c2e
Compare
5e2b858
to
ea50270
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, all tests (except the readdir3
ones, but they failed before) succeed now!
|
|
@kaspar030 do you know what's with that
I don't see a resource leak there - |
agreed.
Same here, I'm on Cppcheck 2.0. So let's assume a Cppcheck bug! |
hit by #14264. |
Can we update cppcheck on CI? |
tests/pkg_fatfs_vfs/main.c
Outdated
/* open file RO */ | ||
fl = fopen(FULL_FNAME2, "r"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So let's assume a Cppcheck bug!
Can we update cppcheck on CI?
Would be easier to suppress this warning for now. @sven-hm please add cppcheck
suppression comment:
/* open file RO */ | |
fl = fopen(FULL_FNAME2, "r"); | |
/* cppcheck-suppress resourceLeak | |
* (reason: cppcheck <2.0 reports a false positive here */ | |
fl = fopen(FULL_FNAME2, "r"); /* open file RO */ |
* vfs_open with `O_WRONLY | O_CREAT` if file exists * of fopen etc. with newlib
Contribution description
When using
fatfs_vfs
withnewlib
,fopen
will fail in append-mode ("a"
) if the file you want to open already exists.Using
vfs_open(..., O_WRONLY | O_CREAT, 0)
on an existing file will also fail.This PR extends the
test_create
-test case and provides a new test case forfopen
etc.It fixes the mode flag translation to FatFs's
FA_
-flags. The translation should be as in the table:O_
-flagsFA_
-flagsCompare flag-table here.
Testing procedure
Run these tests on your hardware with an SD-card as described in the REAME.