increase buffer size in PosixFileSystem::GetAbsolutePath to PATH_MAX (#10413)

Summary:
RocksDB fails to open database with relative path when length of cwd
is longer than 256 bytes. This happens due to ERANGE in getcwd call.
Here we simply increase buffer size to the most common PATH_MAX value.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/10413

Reviewed By: riversand963

Differential Revision: D38189254

Pulled By: ajkr

fbshipit-source-id: 8a0d3a78bbe87645499fbf29fb12bd3d04cd4657
main
Vladimir Kikhtenko 2 years ago committed by Facebook GitHub Bot
parent 87b82f28a1
commit 8d664ccb07
  1. 4
      env/fs_posix.cc

4
env/fs_posix.cc vendored

@ -839,8 +839,8 @@ class PosixFileSystem : public FileSystem {
return IOStatus::OK(); return IOStatus::OK();
} }
char the_path[256]; char the_path[4096];
char* ret = getcwd(the_path, 256); char* ret = getcwd(the_path, 4096);
if (ret == nullptr) { if (ret == nullptr) {
return IOStatus::IOError(errnoStr(errno).c_str()); return IOStatus::IOError(errnoStr(errno).c_str());
} }

Loading…
Cancel
Save