PR: 281953
Details
Details
Diff Detail
Diff Detail
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
Comment Actions
Code should account for O_RDWR case.
The earlier test if (!(flags & O_RDWR) && buf == NULL) in the same file fmemopen.c is also dubious and should be adjusted similarly.
Test should also check a read/write mode like "r+" or "w+".
lib/libc/stdio/fmemopen.c | ||
---|---|---|
141 | What happens if fmemopen() is called with mode "r+" or "w+", yielding (flags & O_ACCMODE) == O_RDWR? |
lib/libc/stdio/fmemopen.c | ||
---|---|---|
141 | oops, that's a nice catch. |
lib/libc/stdio/fmemopen.c | ||
---|---|---|
141 | Then both tests are false and we use fmemopen_read and fmemopen_write? |
lib/libc/stdio/fmemopen.c | ||
---|---|---|
141 | yep, that sounds correct. |
Comment Actions
r+ and w+ are implicitly tested in other test cases; I'm not sure we need to duplicate that (but could add a comment).
Comment Actions
add a comment, fix another case reported by @fuz (that worked by accident, as it turns out)
lib/libc/tests/stdio/fmemopen2_test.c | ||
---|---|---|
298 ↗ | (On Diff #145394) | as above |