diff options
Diffstat (limited to 'TAO/TAO_IDL/driver/drv_preproc.cpp')
-rw-r--r-- | TAO/TAO_IDL/driver/drv_preproc.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/TAO/TAO_IDL/driver/drv_preproc.cpp b/TAO/TAO_IDL/driver/drv_preproc.cpp index 50df446333a..506d948bccf 100644 --- a/TAO/TAO_IDL/driver/drv_preproc.cpp +++ b/TAO/TAO_IDL/driver/drv_preproc.cpp @@ -483,8 +483,14 @@ DRV_pre_proc (const char *myfile) cpp_options.command_line (arglist); + /// Remove any existing output file. + (void) ACE_OS::unlink (tmp_file); + + // If the following open() fails, then we're either being hit with a + // symbolic link attack, or another process opened the file before + // us. ACE_HANDLE fd = ACE_OS::open (tmp_file, - O_WRONLY | O_CREAT | O_TRUNC, + O_WRONLY | O_CREAT | O_EXCL, ACE_DEFAULT_FILE_PERMS); if (fd == ACE_INVALID_HANDLE) |