Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-3710

libhdfs misuses O_RDONLY/WRONLY/RDWR

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 2.0.0-alpha
    • 2.0.2-alpha
    • libhdfs
    • 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

        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

              adi2 Andy Isaacson
              adi2 Andy Isaacson
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: