Hadoop HDFS
  1. Hadoop HDFS
  2. HDFS-3710

libhdfs misuses O_RDONLY/WRONLY/RDWR

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-alpha
    • Fix Version/s: 2.0.2-alpha
    • Component/s: libhdfs
    • Labels:
      None
    • Hadoop Flags:
      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.

      1. hdfs-3710.txt
        4 kB
        Andy Isaacson
      2. hdfs-3710-2.txt
        4 kB
        Andy Isaacson
      3. hdfs-3710-3.txt
        4 kB
        Andy Isaacson

        Issue Links

          Activity

            People

            • Assignee:
              Andy Isaacson
              Reporter:
              Andy Isaacson
            • Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development