jcf-write.c (write_classfile): Remove target class file...

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
This commit is contained in:
Ranjit Mathew 2002-11-22 21:01:24 +00:00 committed by Tom Tromey
parent 42766f8db1
commit 34744d4e5f
2 changed files with 16 additions and 0 deletions

View File

@ -1,3 +1,10 @@
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.

View File

@ -3422,6 +3422,15 @@ write_classfile (clas)
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);