-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
The sample code contains the follow tests:
.read((flags & O_RDONLY != 0) | (flags & O_RDWR != 0))
.write((flags & O_WRONLY != 0) | (flags & O_RDWR != 0))
However O_RDONLY is 0 so the test is bogus and gives a clippy warning.
The O_XXXXvalues are not bit masks but rather they are values for the two low order bits of the flags value. The tests should probably look somethign like this:
.read((flags & 3) == O_RDONLY || (flags & 3) == O_RDWR)
.write((flags & 3) == O_WRONLY || (flags & 3) == O_RDWR)
Metadata
Metadata
Assignees
Labels
No labels