diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2011-05-03 23:22:48 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2011-05-03 23:22:48 +0000 |
commit | 38e862480e900fb5b5a45c52829ed386691f1eb5 (patch) | |
tree | e330611ed57f389071a929cc8c178afb0eda6ec1 /Build | |
parent | ea60c9b2e86820149b3fd3dde22d15a6d453ebbe (diff) |
openclose.c (recorder_change_filename): on windows, an opened file cannot be renamed.
git-svn-id: svn://tug.org/texlive/trunk@22296 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build')
-rw-r--r-- | Build/source/texk/web2c/lib/ChangeLog | 5 | ||||
-rw-r--r-- | Build/source/texk/web2c/lib/openclose.c | 17 |
2 files changed, 21 insertions, 1 deletions
diff --git a/Build/source/texk/web2c/lib/ChangeLog b/Build/source/texk/web2c/lib/ChangeLog index 20e6f7a0007..cb8b3645619 100644 --- a/Build/source/texk/web2c/lib/ChangeLog +++ b/Build/source/texk/web2c/lib/ChangeLog @@ -1,3 +1,8 @@ +2011-05-04 Akira Kakuto <kakuto@fuk.kindai.ac.jp> + + * openclose.c (recorder_change_filename): on windows, an opened file + cannot be renamed. + 2011-05-02 Karl Berry <karl@tug.org> * openclose.c (recorder_change_filename): take output_directory diff --git a/Build/source/texk/web2c/lib/openclose.c b/Build/source/texk/web2c/lib/openclose.c index 1e46a2224bc..a42c14c1036 100644 --- a/Build/source/texk/web2c/lib/openclose.c +++ b/Build/source/texk/web2c/lib/openclose.c @@ -82,16 +82,31 @@ recorder_change_filename (string new_name) if (!recorder_file) return; + /* On windows, an opened file cannot be renamed. */ +#if defined(WIN32) + fclose (recorder_file); +#endif + /* If an output directory was specified, use it. */ if (output_directory) { temp = concat3(output_directory, DIR_SEP_STRING, new_name); new_name = temp; } + /* On windows, renaming fails if a file with new_name exists. */ +#if defined(WIN32) + remove (new_name); +#endif + rename(recorder_name, new_name); free(recorder_name); recorder_name = xstrdup(new_name); - + + /* reopen the recorder file by FOPEN_A_MODE. */ +#if defined(WIN32) + recorder_file = fopen (recorder_name, FOPEN_A_MODE); +#endif + if (temp) free (temp); } |