Commit 614d4f4d authored by mdurant's avatar mdurant
Browse files

Fixing a crash in a file-name handling routine. This bug was exposed as a...

Fixing a crash in a file-name handling routine.  This bug was exposed as a result of running VisIt on windows with an empty VISITUSERHOME environment variable.  If called with an empty directory argument, the method in FileFunctions.C will crash because it does directory.substr(directory.size() - 1).  To fix this, I check explicitely for the empty 'directory' string and return failure in that case.

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@12457 18c085ea-50e0-402c-830e-de6fd14e8384
parent 9691ec41
...@@ -114,7 +114,7 @@ VisItFstat(int fd, VisItStat_t *buf) ...@@ -114,7 +114,7 @@ VisItFstat(int fd, VisItStat_t *buf)
// //
// Arguments: // Arguments:
// directory : The directory to read. // directory : The directory to read.
// procesOneFile : Callback function to process one file. // processOneFile : Callback function to process one file.
// data : Callback data. // data : Callback data.
// checkAccess : Whether or not to check the file permissions. // checkAccess : Whether or not to check the file permissions.
// //
...@@ -162,7 +162,7 @@ ReadAndProcessDirectory(const std::string &directory, ...@@ -162,7 +162,7 @@ ReadAndProcessDirectory(const std::string &directory,
} }
} }
} }
else else if (directory.size() > 0)
{ {
// Try and read the files in fullPath. // Try and read the files in fullPath.
std::string searchPath(directory + std::string("\\*")); std::string searchPath(directory + std::string("\\*"));
...@@ -187,6 +187,9 @@ ReadAndProcessDirectory(const std::string &directory, ...@@ -187,6 +187,9 @@ ReadAndProcessDirectory(const std::string &directory,
} while(FindNextFile(dirHandle, &fd)); } while(FindNextFile(dirHandle, &fd));
FindClose(dirHandle); FindClose(dirHandle);
} }
} else {
//Directory string was empty, nothing to do
retval = false;
} }
#else #else
DIR *dir; DIR *dir;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment