add error check

This commit is contained in:
Glenn Maynard
2003-07-27 03:06:50 +00:00
parent 6d2d6911c3
commit bb86fe9953
+6 -1
View File
@@ -75,7 +75,12 @@ void FileSet::LoadFromDir(const CString &dir)
char buf[PATH_MAX];
bool ret = getcwd(buf, PATH_MAX) != NULL;
ASSERT(ret);
chdir(dir.c_str());
if( chdir(dir.c_str()) == -1 )
{
/* Only log once per dir. */
LOG->MapLog("chdir " + dir, "Couldn't chdir(%s): %s", dir.c_str(), strerror(errno) );
return;
}
DIR *d = opendir(".");
while(struct dirent *ent = readdir(d))