Shell history file accesses should capture errno earlier

XMLWordPrintableJSON

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

      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
              Reporter:
              Kevin Pulo
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: