Commit 34744d4e by Ranjit Mathew Committed by Tom Tromey

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
parent 42766f8d
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.
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment