forked from Smithay/input.rs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The original code masks flags with O_RDONLY, which is 0: ``` .read((flags & O_RDONLY != 0) | (flags & O_RDWR != 0)) .write((flags & O_WRONLY != 0) | (flags & O_RDWR != 0)) ``` This generates Clippy errors because it's equivalent to 0 & 0 != 0. The correct code uses O_ACCMODE to mask off the lower bits: ``` .read((flags & O_ACCMODE == O_RDONLY) | (flags & O_ACCMODE == O_RDWR)) .write((flags & O_ACCMODE == O_WRONLY) | (flags & O_ACCMODE == O_RDWR)) ``` The code could be further simplified with `let access_flags = flags & O_ACCMODE` at the top, but this version maintains the original intent and consistency with similar libinput examples across the internet. This commit updates all 3 occurrences of the code fragment. Fixes Smithay#66 Signed-off-by: Tom Stokes <[email protected]>
- Loading branch information
Showing
3 changed files
with
9 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters