Skip to content

Commit

Permalink
Use thread-safe strerror_r() to get error message (#8087)
Browse files Browse the repository at this point in the history
Summary:
`strerror()` is not thread-safe, using `strerror_r()` instead. The API could be different on the different platforms, used the code from https://github.com/facebook/folly/blob/0deef031cb8aab76dc7e736f8b7c22d701d5f36b/folly/String.cpp#L457

Pull Request resolved: facebook/rocksdb#8087

Reviewed By: mrambacher

Differential Revision: D27267151

Pulled By: jay-zhuang

fbshipit-source-id: 4b8856d1ec069d5f239b764750682c56e5be9ddb
Signed-off-by: Changlong Chen <levisonchen@live.cn>
  • Loading branch information
jay-zhuang authored and Changlong Chen committed Jun 18, 2021
1 parent 72f7879 commit 9490cb2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion env/fs_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ class PosixFileSystem : public FileSystem {
char the_path[256];
char* ret = getcwd(the_path, 256);
if (ret == nullptr) {
return IOStatus::IOError(strerror(errno));
return IOStatus::IOError(errnoStr(errno).c_str());
}

*output_path = ret;
Expand Down

0 comments on commit 9490cb2

Please sign in to comment.