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

Shell history file accesses should capture errno earlier

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 4.1.13
    • Affects Version/s: None
    • Component/s: Shell
    • Labels:
      None
    • Fully Compatible
    • Sharding 2019-05-06, Sharding 2019-05-20, Sharding 2019-06-03

      In this code

      std::stringstream ss;
      ss << "Unable to " << what << " file " << filename << ": " << mongo::errnoWithDescription();
      

      errno is captured too late — it may have been reset by the stringstream by the time errnoWithDescription() uses it.

      There are also a few places where closing the file in response to an error, clobbers the actual errno of interest.

            Assignee:
            kevin.pulo@mongodb.com Kevin Pulo
            Reporter:
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: