diff options
author | Ranjit Mathew <rmathew@hotmail.com> | 2002-11-22 21:01:24 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2002-11-22 21:01:24 +0000 |
commit | 34744d4e5f096a4e50a089bbed764de091d8ca07 (patch) | |
tree | f9b2a7223f9181fa84275a860717e8b3795ceca0 /gcc/java | |
parent | 42766f8db10808bc630c7e8093b7e1451c849b49 (diff) | |
download | gcc-34744d4e5f096a4e50a089bbed764de091d8ca07.zip gcc-34744d4e5f096a4e50a089bbed764de091d8ca07.tar.gz gcc-34744d4e5f096a4e50a089bbed764de091d8ca07.tar.bz2 |
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
Diffstat (limited to 'gcc/java')
-rw-r--r-- | gcc/java/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/java/jcf-write.c | 9 |
2 files changed, 16 insertions, 0 deletions
diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 31379a1..0a2f1dc 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -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. diff --git a/gcc/java/jcf-write.c b/gcc/java/jcf-write.c index 1a9f107..47cfd11 100644 --- a/gcc/java/jcf-write.c +++ b/gcc/java/jcf-write.c @@ -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); |