added missing locks, that caused random crashes

git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5.0@2561 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2010-03-16 12:42:52 +00:00
parent 235c6fba4e
commit a914e463d3
2 changed files with 5 additions and 2 deletions

View File

@ -109,13 +109,13 @@ bool ftFileCreator::addFileData(uint64_t offset, uint32_t chunk_size, void *data
*/
if (0 != fseeko64(this->fd, offset, SEEK_SET))
{
std::cerr << "ftFileCreator::addFileData() Bad fseek" << std::endl;
std::cerr << "ftFileCreator::addFileData() Bad fseek at offset " << offset << ", fd=" << (void*)(this->fd) << ", size=" << mSize << ", errno=" << errno << std::endl;
return 0;
}
if (1 != fwrite(data, chunk_size, 1, this->fd))
{
std::cerr << "ftFileCreator::addFileData() Bad fwrite" << std::endl;
std::cerr << "ftFileCreator::addFileData() Bad fwrite." << std::endl;
std::cerr << "ERRNO: " << errno << std::endl;
return 0;

View File

@ -1346,11 +1346,13 @@ bool AuthGPG::SignDataBin(std::string input, unsigned char *sign, unsigned int *
}
bool AuthGPG::SignDataBin(const void *data, unsigned int datalen, unsigned char *sign, unsigned int *signlen) {
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
return DoOwnSignature_locked(data, datalen,
sign, signlen);
}
bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *sign, unsigned int signlen, std::string withfingerprint) {
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
return VerifySignature_locked(data, datalen,
sign, signlen, withfingerprint);
}
@ -1360,6 +1362,7 @@ bool AuthGPG::VerifySignBin(const void *data, uint32_t datalen, unsigned char *s
int AuthGPG::privateSignCertificate(std::string id)
{
RsStackMutex stack(pgpMtx); /******* LOCKED ******/
/* The key should be in Others list and not in Peers list ??
* Once the key is signed, it moves from Others to Peers list ???
*/