[SERVER-40953] Shell history file accesses should capture errno earlier Created: 02/May/19  Updated: 29/Oct/23  Resolved: 29/May/19

Status: Closed
Project: Core Server
Component/s: Shell
Affects Version/s: None
Fix Version/s: 4.1.13

Type: Improvement Priority: Minor - P4
Reporter: Kevin Pulo Assignee: Kevin Pulo
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-41353 Fix late calls to errnoWithDescription() Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2019-05-06, Sharding 2019-05-20, Sharding 2019-06-03
Participants:

 Description   

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.



 Comments   
Comment by Githook User [ 29/May/19 ]

Author:

{'name': 'Kevin Pulo', 'email': 'kevin.pulo@mongodb.com', 'username': 'devkev'}

Message: SERVER-40953 capture errno earlier when accessing shell history file
Branch: master
https://github.com/mongodb/mongo/commit/20309e67435425d15ec6549bf41b0bd10fd662f7

Generated at Thu Feb 08 04:56:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.