Fix Compilation when mkstemp is not defined.

This commit is contained in:
Phenom 2016-06-01 22:37:05 +02:00
parent 617a863f12
commit 005af47fe9

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)
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))
{