summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/fileutl.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:54:16 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:54:16 +0000
commit13d87e2e0f84512bc139637635b1e5025fa82a6c (patch)
treeaa40b4ff29cde5f7e937a238284a8abb337ce582 /apt-pkg/contrib/fileutl.cc
parentd64663d4456b9b755af220a511de98c6d4bd4af3 (diff)
Added an open function
Author: jgg Date: 1999-07-11 22:42:32 GMT Added an open function
Diffstat (limited to 'apt-pkg/contrib/fileutl.cc')
-rw-r--r--apt-pkg/contrib/fileutl.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 43717da16..4374dd7d5 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.27 1999/04/20 05:02:09 jgg Exp $
+// $Id: fileutl.cc,v 1.28 1999/07/11 22:42:32 jgg Exp $
/* ######################################################################
File Utilities
@@ -250,11 +250,12 @@ int ExecFork()
}
/*}}}*/
-// FileFd::FileFd - Open a file /*{{{*/
+// FileFd::Open - Open a file /*{{{*/
// ---------------------------------------------------------------------
/* The most commonly used open mode combinations are given with Mode */
-FileFd::FileFd(string FileName,OpenMode Mode, unsigned long Perms)
+bool FileFd::Open(string FileName,OpenMode Mode, unsigned long Perms)
{
+ Close();
Flags = AutoClose;
switch (Mode)
{
@@ -281,12 +282,11 @@ FileFd::FileFd(string FileName,OpenMode Mode, unsigned long Perms)
}
if (iFd < 0)
- _error->Errno("open","Could not open file %s",FileName.c_str());
- else
- {
- this->FileName = FileName;
- SetCloseExec(iFd,true);
- }
+ return _error->Errno("open","Could not open file %s",FileName.c_str());
+
+ this->FileName = FileName;
+ SetCloseExec(iFd,true);
+ return true;
}
/*}}}*/
// FileFd::~File - Closes the file /*{{{*/