From 8d664ccb071f2b6844a765835f14c19336426121 Mon Sep 17 00:00:00 2001 From: Vladimir Kikhtenko Date: Tue, 2 Aug 2022 17:18:18 -0700 Subject: [PATCH] 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 --- env/fs_posix.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/env/fs_posix.cc b/env/fs_posix.cc index 8a742da5d..e1b1400d0 100644 --- a/env/fs_posix.cc +++ b/env/fs_posix.cc @@ -839,8 +839,8 @@ class PosixFileSystem : public FileSystem { return IOStatus::OK(); } - char the_path[256]; - char* ret = getcwd(the_path, 256); + char the_path[4096]; + char* ret = getcwd(the_path, 4096); if (ret == nullptr) { return IOStatus::IOError(errnoStr(errno).c_str()); }