From 59a704f0efe9cf243f1b27ac833558b89728aa9c Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 22 Aug 2005 08:48:50 +0000 Subject: * rred.cc: use the d'tor of FileFd to close the file-fd; acquuire-item.cc: make the QueueNextDiff() code more robust --- methods/rred.cc | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'methods/rred.cc') diff --git a/methods/rred.cc b/methods/rred.cc index e28dc6855..3097fca02 100644 --- a/methods/rred.cc +++ b/methods/rred.cc @@ -178,7 +178,8 @@ bool RredMethod::Fetch(FetchItem *Itm) URIStart(Res); // Res.Filename the destination filename - // Open the source and destination files + // Open the source and destination files (the d'tor of FileFd will do + // the cleanup/closing of the fds) FileFd From(Path,FileFd::ReadOnly); FileFd Patch(Path+".ed",FileFd::ReadOnly); FileFd To(Itm->DestFile,FileFd::WriteEmpty); @@ -193,14 +194,6 @@ bool RredMethod::Fetch(FetchItem *Itm) // now do the actual patching ed_file(fPatch, fFrom, fTo, &Hash); - // clean up - fclose(fFrom); - fclose(fPatch); - fclose(fTo); - To.Close(); - From.Close(); - Patch.Close(); - // XXX need to get the size // Res.Size = Buf.st_size; Res.TakeHashes(Hash); -- cgit v1.2.3-70-g09d2