summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-09-18 06:52:40 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-09-18 06:52:40 +0000
commit6a058d5875c14301b4268dc61a6b98e1e5241533 (patch)
tree61e8573a50957808cfc9136fb72c92fe113e8fdd
parent2442150a8f5c5021ee561bb29e62d83fce4ecf72 (diff)
downloadATCD-6a058d5875c14301b4268dc61a6b98e1e5241533.tar.gz
.
-rw-r--r--ace/ACE.cpp16
-rw-r--r--ace/ACE.h6
2 files changed, 12 insertions, 10 deletions
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 1c45ac37551..8a30840942e 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -852,7 +852,7 @@ ACE::ldopen (const ASYS_TCHAR *filename,
}
ACE_HANDLE
-ACE::open_temp_file (char* name, int mode, int perm)
+ACE::open_temp_file (const char *name, int mode, int perm)
{
#if defined (ACE_WIN32)
return ACE_OS::open (name,
@@ -860,15 +860,17 @@ ACE::open_temp_file (char* name, int mode, int perm)
#else
// Open it.
ACE_HANDLE handle = ACE_OS::open (name, mode, perm);
- if (handle == -1)
- return -1;
- // Unlink it.
+ if (handle == ACE_INVALID_HANDLE)
+ return ACE_INVALID_HANDLE;
+
+ // Unlink it so that the file will be removed automatically when the
+ // process goes away.
if (ACE_OS::unlink (name) == -1)
return -1;
-
- // Return the handle.
- return handle;
+ else
+ // Return the handle.
+ return handle;
#endif /* ACE_WIN32 */
}
diff --git a/ace/ACE.h b/ace/ACE.h
index d00c222296d..badcaa2ace1 100644
--- a/ace/ACE.h
+++ b/ace/ACE.h
@@ -534,11 +534,11 @@ public:
// returns a pointer to the file, else it returns a NULL
// pointer. <type> specifies how the file should be open.
- static ACE_HANDLE open_temp_file (char* name,
+ static ACE_HANDLE open_temp_file (const char *name,
int mode,
int perm = 0);
- // Opening the temp file. File gets unlinked when the it is
- // closed. Cool for having temp files.
+ // Opening the temp file. File is automagically unlinked when it is
+ // closed. This is useful for have temp files.
// = Shield us from Win32's inability to select on STDIN.