diff options
author | Steve Huston <shuston@riverace.com> | 2014-10-10 21:58:31 +0000 |
---|---|---|
committer | Steve Huston <shuston@riverace.com> | 2014-10-10 21:58:31 +0000 |
commit | ad906bbed19a4e2e35a3adb429de6cb678217aec (patch) | |
tree | dc3bbf6d52c1dd3b1f89607aec46d33c94e7b2a6 /ACE/apps | |
parent | 8cb211430ac1af0f738444209565ca9aa2840a62 (diff) | |
download | ATCD-ad906bbed19a4e2e35a3adb429de6cb678217aec.tar.gz |
ChangeLogTag:Thu Oct 9 16:21:38 UTC 2014 Steve Huston <shuston@riverace.com>
Diffstat (limited to 'ACE/apps')
-rw-r--r-- | ACE/apps/drwho/File_Manager.cpp | 5 | ||||
-rw-r--r-- | ACE/apps/mkcsregdb/mkcsregdb.cpp | 26 |
2 files changed, 24 insertions, 7 deletions
diff --git a/ACE/apps/drwho/File_Manager.cpp b/ACE/apps/drwho/File_Manager.cpp index f9d46814dc8..92f32fdfa39 100644 --- a/ACE/apps/drwho/File_Manager.cpp +++ b/ACE/apps/drwho/File_Manager.cpp @@ -73,8 +73,9 @@ File_Manager::get_login_and_real_name (const char *&login_name, const char *&rea int File_Manager::open_passwd_file (void) { - const char *filename = ACE_OS::tempnam (); - FILE *fp = ACE_OS::fopen (filename, "w"); + char *filename = "passwd-XXXXXX"; + ACE_HANDLE f = ACE_OS::mkstemp (filename); + FILE *fp = ACE_OS::fdopen (f, "w"); if (fp == 0) return -1; diff --git a/ACE/apps/mkcsregdb/mkcsregdb.cpp b/ACE/apps/mkcsregdb/mkcsregdb.cpp index bdb112c14b8..7b3ff7fffa7 100644 --- a/ACE/apps/mkcsregdb/mkcsregdb.cpp +++ b/ACE/apps/mkcsregdb/mkcsregdb.cpp @@ -42,7 +42,7 @@ private: char *line_data_; ifstream *inf_; FILE *outf_; - char *tempfilename_; + char tempfilename_[MAXPATHLEN]; char *ace_src_; }; @@ -68,6 +68,7 @@ csdb_generator::csdb_generator () outf_ (0) { ace_src_ = ACE_OS::getenv("ACE_ROOT"); + tempfilename_[0] = '\0'; } void @@ -227,10 +228,25 @@ csdb_generator::init_output (const char *srcfile) ACE_ERROR_RETURN ((LM_ERROR,"You must first set $ACE_ROOT\n"),-1); time_t now = ACE_OS::time(); - tempfilename_ = ACE_OS::tempnam (ace_src_,"csdb"); - outf_ = ACE_OS::fopen (tempfilename_,"w"); - if (outf_ == 0) - ACE_ERROR_RETURN ((LM_ERROR, "Unable to open output file, %s\n",tempfilename_),-1); + if (ACE_OS::strlen(ace_src_) > 0) + { + ACE_OS::sprintf (tempfilename_, + "%s%s%s", + ace_src_, + ACE_DIRECTORY_SEPARATOR_STR, + "csdbXXXXXX"); + } + else + { + ACE_OS::strcpy (tempfilename_, "csdbXXXXXX"); + } + int fd = ACE_OS::mkstemp (tempfilename_); + if (fd == -1) + ACE_ERROR_RETURN ((LM_ERROR, + "Unable to open output file, %p\n", + tempfilename_), + -1); + outf_ = ACE_OS::fdopen (fd, "w"); ACE_OS::fprintf (outf_,"// $ID: $\n"); ACE_OS::fprintf (outf_,"/*\n * Codeset registry DB, generated %s * source: %s\n", |