diff options
author | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-14 16:35:59 +0000 |
---|---|---|
committer | levine <levine@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1997-07-14 16:35:59 +0000 |
commit | 6cb1d958c0d8a7d396e790f5c1fb121cc0e01ca7 (patch) | |
tree | e5dfafe5b891df3512a2a6e7b3e86ff440593e91 /tests/test_config.h | |
parent | c314a1181bff31634c0ea7963609fc9517245f4e (diff) | |
download | ATCD-6cb1d958c0d8a7d396e790f5c1fb121cc0e01ca7.tar.gz |
(set_output): added VxWorks-specific code to not create the log directory because that doesn't seem to work, and to unlink to old log file, if any
Diffstat (limited to 'tests/test_config.h')
-rw-r--r-- | tests/test_config.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_config.h b/tests/test_config.h index cec49951d40..31da4a003ad 100644 --- a/tests/test_config.h +++ b/tests/test_config.h @@ -165,19 +165,38 @@ ACE_Test_Output::set_output (const char *filename, int append) { char temp[BUFSIZ]; // Ignore the error value since the directory may already exist. - ACE_OS::mkdir (ACE_LOG_DIRECTORY_A); + ACE_OS::sprintf (temp, "%s%s%s", ACE_LOG_DIRECTORY_A, ACE::basename (filename, ACE_DIRECTORY_SEPARATOR_CHAR_A), ".log"); +#if defined (VXWORKS) + // This is the only way I could figure out to avoid a console warning + // about opening an existing file (w/o O_CREAT), or attempting to unlink + // a non-existant one. + int fd; + if ((fd = ACE_OS::open (temp, O_WRONLY | O_CREAT, 0x644)) != ERROR) + { + ACE_OS::close (fd); + ACE_OS::unlink (temp); + } +#else + // This doesn't seem to work on VxWorks if the directory doesn't + // exist, and causes a wierd console error message about + // "cat: input error on standard input: Is a directory" if it does. + ACE_OS::mkdir (ACE_LOG_DIRECTORY_A); +#endif /* ! VXWORKS */ + int flags = ios::out; if (append) flags |= ios::app; this->output_file_.open (temp, flags); if (this->output_file_.bad ()) - return -1; + { + return -1; + } ACE_LOG_MSG->msg_ostream (ace_file_stream.output_file ()); ACE_LOG_MSG->clr_flags (ACE_Log_Msg::STDERR | ACE_Log_Msg::LOGGER ); |