BUG: When removing directory, use lstat instead of stat to make sure that symlinks are treated as files and not as directories

This commit is contained in:
Andy Cedilnik 2005-07-12 10:40:14 -04:00
parent 2dc914c839
commit 219bcf25ba
2 changed files with 7 additions and 1 deletions

View File

@ -29,7 +29,9 @@ bool cmCTestEmptyBinaryDirectoryCommand::InitialPass(
if ( !cmCTestScriptHandler::EmptyBinaryDirectory(args[0].c_str()) ) if ( !cmCTestScriptHandler::EmptyBinaryDirectory(args[0].c_str()) )
{ {
this->SetError("problem removing the binary directory"); cmOStringStream ostr;
ostr << "problem removing the binary directory: " << args[0].c_str();
this->SetError(ostr.str().c_str());
return false; return false;
} }

View File

@ -2044,7 +2044,11 @@ kwsys_stl::string SystemTools
bool SystemTools::FileIsDirectory(const char* name) bool SystemTools::FileIsDirectory(const char* name)
{ {
struct stat fs; struct stat fs;
#if _WIN32
if(stat(name, &fs) == 0) if(stat(name, &fs) == 0)
#else
if(lstat(name, &fs) == 0)
#endif
{ {
#if _WIN32 #if _WIN32
return ((fs.st_mode & _S_IFDIR) != 0); return ((fs.st_mode & _S_IFDIR) != 0);