[CABMAN] Fix a problem with creating temp files on some Windows system
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 3 Apr 2018 19:25:04 +0000 (21:25 +0200)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Sat, 29 Dec 2018 20:37:42 +0000 (21:37 +0100)
sdk/tools/cabman/CCFDATAStorage.cxx

index 1d7ef5e..b02551f 100644 (file)
@@ -56,7 +56,12 @@ CCFDATAStorage::~CCFDATAStorage()
 ULONG CCFDATAStorage::Create()
 {
     if ((FileHandle = tmpfile()) == NULL)
-        return CAB_STATUS_CANNOT_CREATE;
+    {
+        /* Workaround for breakage on some Windows system */
+        FileHandle = fopen(tmpnam(NULL) + 1, "wb");
+        if (FileHandle == NULL)
+            return CAB_STATUS_CANNOT_CREATE;
+    }
 
     return CAB_STATUS_SUCCESS;
 }