From 07db72ec7e1d17602ab313bdb849bca748b4d0d8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 6 Oct 2006 13:32:11 +0000 Subject: [PATCH] Ensure temp file is closed before its directory is removed. --- lib/ChangeLog | 5 +++++ lib/javacomp.c | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 6e58ab995..e740b5544 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,3 +1,8 @@ +2006-10-06 Bruno Haible + + * javacomp.c (write_temp_file): Use fopen_temp, fwriteerror_temp + instead of fopen, fwriteerror. + 2006-10-05 Bruno Haible * clean-temp.h (open_temp, fopen_temp, close_temp, fclose_temp, diff --git a/lib/javacomp.c b/lib/javacomp.c index f3e8a1812..ba0f43700 100644 --- a/lib/javacomp.c +++ b/lib/javacomp.c @@ -467,7 +467,7 @@ write_temp_file (struct temp_dir *tmpdir, const char *file_name, FILE *fp; register_temp_file (tmpdir, file_name); - fp = fopen (file_name, "w"); + fp = fopen_temp (file_name, "w"); if (fp == NULL) { error (0, errno, _("failed to create \"%s\""), file_name); @@ -475,7 +475,7 @@ write_temp_file (struct temp_dir *tmpdir, const char *file_name, return true; } fputs (contents, fp); - if (fwriteerror (fp)) + if (fwriteerror_temp (fp)) { error (0, errno, _("error while writing \"%s\" file"), file_name); return true; -- 2.11.0