summaryrefslogtreecommitdiff
path: root/indra/llvfs/lldir_linux.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llvfs/lldir_linux.cpp')
-rw-r--r--indra/llvfs/lldir_linux.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp
index bc8c173492..42e84edf44 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -55,7 +55,16 @@ LLDir_Linux::LLDir_Linux()
mDirp = NULL;
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
- getcwd(tmp_str, LL_MAX_PATH);
+ if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
+ {
+ strcpy(tmp_str, "/tmp");
+ llwarns << "Could not get current directory; changing to "
+ << tmp_str << llendl;
+ if (chdir(tmp_str) == -1)
+ {
+ llerrs << "Could not change directory to " << tmp_str << llendl;
+ }
+ }
mExecutableFilename = "";
mExecutablePathAndName = "";
@@ -308,7 +317,11 @@ void LLDir_Linux::getRandomFileInDir(const std::string &dirname, const std::stri
std::string LLDir_Linux::getCurPath()
{
char tmp_str[LL_MAX_PATH]; /* Flawfinder: ignore */
- getcwd(tmp_str, LL_MAX_PATH);
+ if (getcwd(tmp_str, LL_MAX_PATH) == NULL)
+ {
+ llwarns << "Could not get current directory" << llendl;
+ tmp_str[0] = '\0';
+ }
return tmp_str;
}