summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:50:50 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:50:50 +0000
commit1164783d22d97e7ca0454e23faad8f8bb70a901d (patch)
tree0d303b703236c56562c7010f269cd23b9d7527c5 /apt-pkg/contrib/fileutl.cc
parentfaf4e30cb406bf35c9bb3ec7c018107ea6e01eba (diff)
Compile of apt-cache
Author: jgg Date: 1998-07-15 05:56:42 GMT Compile of apt-cache
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc9
1 files changed, 5 insertions, 4 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 1b087696d..6f515fd67 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: fileutl.cc,v 1.4 1998/07/12 23:58:48 jgg Exp $
+// $Id: fileutl.cc,v 1.5 1998/07/15 05:56:43 jgg Exp $
/* ######################################################################
File Utilities
@@ -113,7 +113,7 @@ string SafeGetCWD()
/* The most commonly used open mode combinations are given with Mode */
File::File(string FileName,OpenMode Mode, unsigned long Perms)
{
- Flags = 0;
+ Flags = AutoClose;
switch (Mode)
{
case ReadOnly:
@@ -205,9 +205,10 @@ bool File::Close()
{
bool Res = true;
if ((Flags & AutoClose) == AutoClose)
- if (close(iFd) != 0)
+ if (iFd >= 0 && close(iFd) != 0)
Res &= _error->Errno("close","Problem closing the file");
-
+ iFd = -1;
+
if ((Flags & Fail) == Fail && (Flags & DelOnFail) == DelOnFail &&
FileName.empty() == false)
if (unlink(FileName.c_str()) != 0)