[Bug 3175] New: Fix testing for readonly flags on GNU/Hurd
Exim Bugzilla via Exim-dev <[email protected]>
| Newsgroups | gmane.mail.exim.devel |
|---|---|
| Message-ID | <[email protected]/> |
https://bugs.exim.org/show_bug.cgi?id=3175
Bug ID: 3175
Summary: Fix testing for readonly flags on GNU/Hurd
Product: Exim
Version: N/A
Hardware: x86
OS: Linux
Status: NEW
Severity: bug
Priority: medium
Component: General execution
Assignee: [email protected]
Reporter: [email protected]
CC: [email protected]
Created attachment 1519
--> https://bugs.exim.org/attachment.cgi?id=1519&action=edit
proposed fix
Two places of the code checks for readonly flags this way:
flags & (O_RDWR|O_WRONLY) ? GDBM_WRITER : GDBM_READER
It happens that on GNU/Hurd, O_RDONLY is 1, O_WRONLY is 2, and O_RDWR is 3, so
when flags is O_RDONLY, flags & (O_RDWR|O_WRONLY) is indeed non-null.
Another place of the code uses this way:
(flags & (O_WRONLY|O_RDWR)) == O_RDONLY
That one happens to be correct on GNU/Hurd, as well as on Linux&BSD where
O_RDONLY is 0, O_WRONLY is 1, and O_RDWR is 2. But it looks quite odd, since
O_ACCMODE is available for this:
(flags & O_ACCMODE) == O_RDONLY
(it happens to be doing exactly the same on both GNU/Hurd and Linux&BSD, but
this looks way more posix-correct).
The attached patch fixes this way.
--
You are receiving this mail because:
You are on the CC list for the bug.