Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-1498

strnlen in bsoninlines.h ambiguous with system strnlen in context dependent ways

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 1.5.6
    • Fix Version/s: 1.5.7
    • Component/s: Internal Client
    • Labels:
      None
    • Environment:
      all with strnlen extension
    • Operating System:
      Linux

      Description

      Some systems provide strnlen of various forms. On my system, for instance, its signature is:

      size_t strnlen(const char *s, size_t maxlen);

      util/goodies.h also defines a version of strnlen, presumably to handle platforms where strnlen is not provided. However, its definition conflicts:

      inline int strnlen( const char *s, int n ) ...

      For some files, like bsoninlines.h, that don't include dependent headers, but reference strnlen, the resolved symbol will be the 'system' strnlen, and when included in other contexts, like where goodies.h is in the include chain, this will resolve as mongo::strnlen. If the intention is to use the mongo definition of strnlen, then the uses in these files should be namespace qualified.

        Attachments

          Activity

            People

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            acm Andrew Morrow
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: