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:
parent
2dc914c839
commit
219bcf25ba
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user