Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-1982

MinGW: wrong ifdef check for strerror_r

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.2
    • Affects Version/s: None
    • Component/s: libbson, mingw
    • None

      Wrong:

      
      #if defined(__GNUC__) && defined(_GNU_SOURCE)
         ret = strerror_r (err_code, buf, buflen);
      #elif defined(_WIN32)
         if (strerror_s (buf, buflen, err_code) != 0) {
            ret = buf;
         }
      #else /* XSI strerror_r */
         if (strerror_r (err_code, buf, buflen) == 0) {
            ret = buf;
         }
      #endif
      
      

      Should be:

      
      #if defined(_WIN32)
         if (strerror_s (buf, buflen, err_code) != 0) {
            ret = buf;
         }
      #elif defined(__GNUC__) && defined(_GNU_SOURCE)
         ret = strerror_r (err_code, buf, buflen);
      #else /* XSI strerror_r */
         if (strerror_r (err_code, buf, buflen) == 0) {
            ret = buf;
         }
      #endif
      

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: