2002-11-22 Ranjit Mathew <rmathew@hotmail.com>
Andrew Haley <aph@redhat.com>
* gcc/java/jcf-write.c (write_classfile): Remove target
class file, if it exists, before renaming the temporary
class file to it.
Co-Authored-By: Andrew Haley <aph@redhat.com>
From-SVN: r59386
+2002-11-22 Ranjit Mathew <rmathew@hotmail.com>
+ Andrew Haley <aph@redhat.com>
+
+ * gcc/java/jcf-write.c (write_classfile): Remove target
+ class file, if it exists, before renaming the temporary
+ class file to it.
+
2002-11-19 Jason Thorpe <thorpej@wasabisystems.com>
* jvspec.c (lang_specific_spec_functions): New.
write_chunks (stream, chunks);
if (fclose (stream))
fatal_io_error ("error closing %s", temporary_file_name);
+
+ /* If a file named by the string pointed to by `new' exists
+ prior to the call to the `rename' function, the bahaviour
+ is implementation-defined. ISO 9899-1990 7.9.4.2.
+
+ For example, on Win32 with MSVCRT, it is an error. */
+
+ unlink (class_file_name);
+
if (rename (temporary_file_name, class_file_name) == -1)
{
remove (temporary_file_name);