jerpelea opened a new pull request, #20431: URL: https://github.com/apache/nuttx/pull/20431
## Summary O_DIRECTORY, O_NOFOLLOW, O_NOATIME, O_CLOEXEC, __O_SYNC, O_PATH and __O_TMPFILE are defined as shifts by 16 to 22 bits. Where int is 16 bits (AVR, for example), these shifts exceed the width of the type: GCC evaluates them to 0, and the -Wshift-count-overflow warning is not shown because include/ is a system include directory. The oflags argument of open() is an int, so it could not carry those bits anyway. As a result, on arch with int equal 16-bit opendir() opens directories without O_DIRECTORY, so opening a mount point such as /proc fails with ENOENT, and O_CLOEXEC and O_NOFOLLOW have no effect. When UINT_MAX is 0xffff, use the unused bits 2 to 4 for O_DIRECTORY, O_CLOEXEC and O_NOFOLLOW, define O_NOATIME and __O_SYNC as 0 (O_SYNC falls back to O_DSYNC), and leave O_PATH and O_TMPFILE undefined, so that code which needs them fails to build instead of silently opening with the wrong flags; nothing in the tree uses them. _O_MAXBIT becomes 15. On bigger systems (32-bit, 64-bit) keep the original bit shift. ## Impact RELEASE ## Testing CI -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
