Revert "Replace tempnam with mkstemp"

This reverts commit cd24c230981068b76bda041e6ab302ac2c8ddaad.

The change causes the warning to be removed but replaces it with an equally racy sequence. 

Once the file is removed another process or thread can race to create the file.

As the callers all call fs::create_directory the proper fix is to use mkdtemp in the callers then adjust the permissions as needed later.

Change-Id: Icc34ac1a58be3a226f82c6a5ddfe9da6df95a5ef
Signed-off-by: Milton Miller <mdmii@outlook.com>
diff --git a/certificate.cpp b/certificate.cpp
index 18c68a0..c99b0b0 100644
--- a/certificate.cpp
+++ b/certificate.cpp
@@ -30,7 +30,6 @@
 #include <filesystem>
 #include <fstream>
 #include <map>
-#include <random>
 #include <utility>
 #include <vector>
 
@@ -139,22 +138,17 @@
 std::string
     Certificate::generateUniqueFilePath(const std::string& directoryPath)
 {
-    // Create a template for the temporary file name
-    std::string filePath = directoryPath + "/" + "cert-XXXXXX";
-    int fd = mkstemp(filePath.data());
-    if (fd == -1)
+    char* filePath = tempnam(directoryPath.c_str(), nullptr);
+    if (filePath == nullptr)
     {
         lg2::error(
             "Error occurred while creating random certificate file path, DIR:{DIR}",
             "DIR", directoryPath);
         elog<InternalFailure>();
-        throw std::runtime_error("Failed to create unique file path");
     }
-
-    // Close the file descriptor and file, just need the unique path
-    close(fd);
-    std::remove(filePath.data());
-    return filePath;
+    std::string filePathStr(filePath);
+    free(filePath);
+    return filePathStr;
 }
 
 std::string Certificate::generateAuthCertFileX509Path(