瀏覽代碼

Fixed config handling bug again
Author: jgg
Date: 1998-11-05 07:42:03 GMT
Fixed config handling bug again

Arch Librarian 22 年之前
父節點
當前提交
5a43a24178
共有 1 個文件被更改,包括 8 次插入10 次删除
  1. 8 10
      apt-pkg/init.cc

+ 8 - 10
apt-pkg/init.cc

@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // -*- mode: cpp; mode: fold -*-
 // Description								/*{{{*/
 // 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
    Init - Initialize the package library
@@ -9,10 +9,8 @@
 									/*}}}*/
 									/*}}}*/
 // Include files							/*{{{*/
 // Include files							/*{{{*/
 #include <apt-pkg/init.h>
 #include <apt-pkg/init.h>
+#include <apt-pkg/fileutl.h>
 #include <config.h>
 #include <config.h>
-
-#include <sys/stat.h>
-#include <unistd.h>
 									/*}}}*/
 									/*}}}*/
 
 
 // pkgInitialize - Initialize the configuration class			/*{{{*/
 // pkgInitialize - Initialize the configuration class			/*{{{*/
@@ -50,16 +48,16 @@ bool pkgInitialize(Configuration &Cnf)
    
    
    // Read the main config file
    // Read the main config file
    string FName = Cnf.FindFile("Dir::Etc::main");
    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
    // Read an alternate config file
    const char *Cfg = getenv("APT_CONFIG");
    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;
       return false;
    
    
    if (Cnf.FindB("Debug::pkgInitialize",false) == true)
    if (Cnf.FindB("Debug::pkgInitialize",false) == true)