Fixed: #1105 NLMISC::createDebug - Infinite loop

This commit is contained in:
kervala 2010-09-26 23:08:17 +02:00
parent cfc125cd38
commit 148a7260fc

View file

@ -2392,8 +2392,11 @@ bool CFile::setRWAccess(const std::string &filename)
{ {
// try to set the read/write access // try to set the read/write access
if (_chmod (filename.c_str(), _S_IREAD | _S_IWRITE) == -1) if (_chmod (filename.c_str(), _S_IREAD | _S_IWRITE) == -1)
{
if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads())
{ {
nlwarning ("PATH: Can't set RW access to file '%s': %d %s", filename.c_str(), errno, strerror(errno)); nlwarning ("PATH: Can't set RW access to file '%s': %d %s", filename.c_str(), errno, strerror(errno));
}
return false; return false;
} }
} }
@ -2403,15 +2406,22 @@ bool CFile::setRWAccess(const std::string &filename)
{ {
// try to set the read/write access // try to set the read/write access
if (chmod (filename.c_str(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH) == -1) if (chmod (filename.c_str(), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP|S_IROTH|S_IWOTH|S_IXOTH) == -1)
{
if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads())
{ {
nlwarning ("PATH: Can't set RW access to file '%s': %d %s", filename.c_str(), errno, strerror(errno)); nlwarning ("PATH: Can't set RW access to file '%s': %d %s", filename.c_str(), errno, strerror(errno));
}
return false; return false;
} }
} }
else else
{
if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads())
{ {
nlwarning("PATH: Can't access to file '%s'", filename.c_str()); nlwarning("PATH: Can't access to file '%s'", filename.c_str());
} }
// return false;
}
#endif #endif
return true; return true;
} }
@ -2426,8 +2436,11 @@ bool CFile::deleteFile(const std::string &filename)
setRWAccess(filename); setRWAccess(filename);
int res = unlink (filename.c_str()); int res = unlink (filename.c_str());
if (res == -1) if (res == -1)
{
if (INelContext::getInstance().getAlreadyCreateSharedAmongThreads())
{ {
nlwarning ("PATH: Can't delete file '%s': (errno %d) %s", filename.c_str(), errno, strerror(errno)); nlwarning ("PATH: Can't delete file '%s': (errno %d) %s", filename.c_str(), errno, strerror(errno));
}
return false; return false;
} }
return true; return true;