diff options
author | David Kalnischkies <kalnischkies@gmail.com> | 2012-04-23 19:33:32 +0200 |
---|---|---|
committer | David Kalnischkies <kalnischkies@gmail.com> | 2012-04-23 19:33:32 +0200 |
commit | af13d1437cbcb383de89f126b316c02587e4b691 (patch) | |
tree | ef59465fbafa3dab7aa81070b2411f885695762f /apt-pkg | |
parent | ec76891fa17c77f8fd28b9b6e11ef2d7547afe7e (diff) |
/dev/null is a special absolute path as it has no subdirectories
Diffstat (limited to 'apt-pkg')
-rw-r--r-- | apt-pkg/contrib/configuration.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc index ce02f1bd2..4de17e3e1 100644 --- a/apt-pkg/contrib/configuration.cc +++ b/apt-pkg/contrib/configuration.cc @@ -194,7 +194,11 @@ string Configuration::FindFile(const char *Name,const char *Default) const // Absolute if (val.length() >= 1 && val[0] == '/') + { + if (val.compare(0, 9, "/dev/null") == 0) + val.erase(9); break; + } // ~/foo or ./foo if (val.length() >= 2 && (val[0] == '~' || val[0] == '.') && val[1] == '/') @@ -230,7 +234,12 @@ string Configuration::FindDir(const char *Name,const char *Default) const { string Res = FindFile(Name,Default); if (Res.end()[-1] != '/') + { + size_t const found = Res.rfind("/dev/null"); + if (found != string::npos && found == Res.size() - 9) + return Res; // /dev/null returning return Res + '/'; + } return Res; } /*}}}*/ |