Prevent multiple instances from running on Unix systems.

Every call to RsInit::LoadCertificates() now creates a file:
~/.retroshare/xxxxxxxxxxxxxxxxxxxx/lock
which is then bound to a system lock (fcntl F_SETLK).

If the lock request fails, it means another instance is already
running with the same profile.


git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3241 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
leander-256 2010-07-01 20:30:36 +00:00
parent 840f077826
commit fe46d7618a
7 changed files with 221 additions and 47 deletions

View file

@ -310,7 +310,7 @@ int AuthGPG::GPGInit(std::string ownId)
std::cerr << "AuthGPG::GPGInit finished." << std::endl;
return true;
return 1;
}
AuthGPG::~AuthGPG()
@ -780,7 +780,7 @@ bool AuthGPG::DoOwnSignature(const void *data, unsigned int datalen, void *buf_s
// gpgme_data_write (gpgmeSig, "", 1); // to be able to convert it into a string
char *export_sig = gpgme_data_release_and_get_mem(gpgmeSig, &len);
#ifdef GPG_DEBUG
fprintf(stderr, "AuthGPG::Signature len: %d \n", len);
std::cerr << "AuthGPG::Signature len: " << len << std::endl;
#endif
if (len < *outl) // -1 because we added a 0 at the end.