2 Commits
v0.7 ... v0.7.1

Author SHA1 Message Date
Grégory Soutadé
7b6b1471fe Update version 2022-04-23 17:51:19 +02:00
Grégory Soutadé
4f9b2de5a5 Remove use of tempnam function and fix bug (bad check of rename return) 2022-04-23 17:41:54 +02:00
2 changed files with 7 additions and 7 deletions

View File

@@ -40,7 +40,7 @@
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
#endif
#define LIBGOUROU_VERSION "0.7"
#define LIBGOUROU_VERSION "0.7.1"
namespace gourou
{

View File

@@ -114,16 +114,16 @@ public:
// Use temp file for PDF
if (type == gourou::DRMProcessor::ITEM_TYPE::PDF)
{
char* tempFile = tempnam("/tmp", NULL);
processor.removeDRM(inputFile, tempFile, type, encryptionKey, encryptionKeySize);
std::string tempFile = filename + ".tmp";
/* Be sure there is not already a temp file */
unlink(tempFile.c_str());
processor.removeDRM(filename, tempFile, type, encryptionKey, encryptionKeySize);
/* Original file must be removed before doing a copy... */
unlink(inputFile);
if (!rename(tempFile, filename.c_str()))
unlink(filename.c_str());
if (rename(tempFile.c_str(), filename.c_str()))
{
free(tempFile);
EXCEPTION(gourou::DRM_FILE_ERROR, "Unable to copy " << tempFile << " into " << filename);
}
free(tempFile);
}
else
processor.removeDRM(inputFile, filename, type, encryptionKey, encryptionKeySize);