summaryrefslogtreecommitdiff
path: root/apt-pkg/init.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:51:20 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:51:20 +0000
commit5a43a2417802417e711bc5bbdc3675a0ec79ab1e (patch)
treeb6f7aacc0c2c050f539043a290db97caf6f80c11 /apt-pkg/init.cc
parentbfd22fc0ac2632c6196f5149dc3b3671d9ff15e0 (diff)
Fixed config handling bug again
Author: jgg Date: 1998-11-05 07:42:03 GMT Fixed config handling bug again
Diffstat (limited to 'apt-pkg/init.cc')
-rw-r--r--apt-pkg/init.cc18
1 files changed, 8 insertions, 10 deletions
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index f79668c54..e504e4a14 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -1,6 +1,6 @@
// -*- mode: cpp; mode: fold -*-
// Description /*{{{*/
-// $Id: init.cc,v 1.10 1998/11/05 07:21:42 jgg Exp $
+// $Id: init.cc,v 1.11 1998/11/05 07:42:03 jgg Exp $
/* ######################################################################
Init - Initialize the package library
@@ -9,10 +9,8 @@
/*}}}*/
// Include files /*{{{*/
#include <apt-pkg/init.h>
+#include <apt-pkg/fileutl.h>
#include <config.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
/*}}}*/
// pkgInitialize - Initialize the configuration class /*{{{*/
@@ -50,16 +48,16 @@ bool pkgInitialize(Configuration &Cnf)
// Read the main config file
string FName = Cnf.FindFile("Dir::Etc::main");
- struct stat Buf;
- if (stat(FName.c_str(),&Buf) != 0)
- return true;
+ bool Res = true;
+ if (FileExists(FName) == true)
+ Res &= ReadConfigFile(Cnf,FName);
// Read an alternate config file
const char *Cfg = getenv("APT_CONFIG");
+ if (Cfg != 0 && FileExists(FName) == true)
+ Res &= ReadConfigFile(Cnf,Cfg);
- // Read both config files, either existing will be OK
- if ((ReadConfigFile(Cnf,FName) != true) |
- (ReadConfigFile(Cnf,Cfg) != true))
+ if (Res == false)
return false;
if (Cnf.FindB("Debug::pkgInitialize",false) == true)