Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.0-alpha
-
None
-
Reviewed
Description
The O_RDONLY / O_WRONLY / O_RDWR macros in fcntl.h are not a bitmask; they are an enum stored in the low bits of the flag word. The proper way to use them is
if ((flags & O_ACCMODE) == O_RDONLY)
rather than
if ((flags & O_RDONLY) == 0)
There are many examples of this misuse in hdfs.c.
As a result of this incorrect testing, erroneous code may be accepted without error and correct code might not work correctly.
Attachments
Attachments
Issue Links
- relates to
-
HDFS-3579 libhdfs: fix exception handling
- Closed