Avoid PATH_MAX by using getcwd(nullptr, 0) as supported by modern glibc-based OSes.

This commit is contained in:
Svante Signell 2014-09-30 22:23:27 +02:00 committed by Tatsuhiro Tsujikawa
parent 1d138accb9
commit df875db989
1 changed files with 1 additions and 3 deletions

View File

@ -1225,9 +1225,7 @@ int main(int argc, char **argv)
mod_config()->argv[i] = strdup(argv[i]);
}
char cwd[PATH_MAX];
mod_config()->cwd = getcwd(cwd, sizeof(cwd));
mod_config()->cwd = getcwd(nullptr, 0);
if(mod_config()->cwd == nullptr) {
auto error = errno;
LOG(FATAL) << "failed to get current working directory: errno=" << error;