]> git.saurik.com Git - apt.git/blobdiff - apt-pkg/contrib/fileutl.cc
pkgTagFile: if we have seen the end, do not try to see more
[apt.git] / apt-pkg / contrib / fileutl.cc
index 847d8b47ff70605d61d05a2449696c53169b3504..37155b688173c2c25bc92f043867da53caf1a3e1 100644 (file)
@@ -319,7 +319,7 @@ bool CreateDirectory(string const &Parent, string const &Path)
       return false;
 
    // we are not going to create directories "into the blue"
-   if (Path.find(Parent, 0) != 0)
+   if (Path.compare(0, Parent.length(), Parent) != 0)
       return false;
 
    vector<string> const dirs = VectorizeString(Path.substr(Parent.size()), '/');
@@ -465,7 +465,7 @@ std::vector<string> GetListOfFilesInDir(string const &Dir, std::vector<string> c
       const char *C = Ent->d_name;
       for (; *C != 0; ++C)
         if (isalpha(*C) == 0 && isdigit(*C) == 0
-            && *C != '_' && *C != '-') {
+            && *C != '_' && *C != '-' && *C != ':') {
            // no required extension -> dot is a bad character
            if (*C == '.' && Ext.empty() == false)
               continue;
@@ -1839,7 +1839,7 @@ std::string GetTempDir()
 
    // check that tmpdir is set and exists
    struct stat st;
-   if (!tmpdir || stat(tmpdir, &st) != 0)
+   if (!tmpdir || strlen(tmpdir) == 0 || stat(tmpdir, &st) != 0)
       tmpdir = "/tmp";
 
    return string(tmpdir);