summaryrefslogtreecommitdiff
blob: daeae8cc33a5f868e8ff75f8ecdf03876f85fba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
--- tripwire-2.3.1-2/src/core/unix/unixfsservices.cpp.mkstemp	2001-02-24 14:02:12.000000000 -0500
+++ tripwire-2.3.1-2/src/core/unix/unixfsservices.cpp	2003-01-04 12:54:33.000000000 -0500
@@ -243,6 +243,7 @@
 {
     char* pchTempFileName;
     char szTemplate[MAXPATHLEN];
+    int fd;
 
 #ifdef _UNICODE
     // convert template from wide character to multi-byte string
@@ -253,13 +254,12 @@
     strcpy( szTemplate, strName.c_str() );
 #endif
 
-    // create temp filename
-    pchTempFileName = mktemp( szTemplate );
-
-    //check to see if mktemp failed
-    if ( pchTempFileName == NULL || strlen(pchTempFileName) == 0) {
-      throw eFSServicesGeneric( strName );
-    }
+    // create temp filename and check to see if mkstemp failed
+    if ((fd = mkstemp( szTemplate )) == -1)
+	throw eFSServicesGeneric( strName );
+    else
+	close(fd);
+    pchTempFileName = szTemplate;
 
     // change name so that it has the XXXXXX part filled in
 #ifdef _UNICODE