Merge pull request #402 from PhenomRetroShare/Fix_WindowsCompilationWithMksTemp

Fix Compilation when mkstemp is not defined.
This commit is contained in:
Cyril Soler 2016-06-02 20:38:28 -04:00
commit 699b3cf064

View File

@ -1978,15 +1978,20 @@ bool PGPHandler::removeKeysFromPGPKeyring(const std::set<RsPgpId>& keys_to_remov
char template_name[_pubring_path.length()+8] ;
sprintf(template_name,"%s.XXXXXX",_pubring_path.c_str()) ;
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
int fd_keyring_backup(mkstemp(template_name));
if (fd_keyring_backup == -1)
#else
if(mktemp(template_name) == NULL)
#endif
{
std::cerr << "PGPHandler::removeKeysFromPGPKeyring(): cannot create keyring backup file. Giving up." << std::endl;
error_code = PGP_KEYRING_REMOVAL_ERROR_CANNOT_CREATE_BACKUP ;
return false ;
}
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
close(fd_keyring_backup); // TODO: keep the file open and use the fd
#endif
if(!ops_write_keyring_to_file(_pubring,ops_false,template_name,ops_true))
{