diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2006-08-22 12:04:04 +0000 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2006-08-22 12:04:04 +0000 |
commit | e9c8c04c3c1a4fe8eac8576a4a7db52ce4b30052 (patch) | |
tree | d64c4f4eed579bafbcb5ceb8f0b0dae1d3a13d20 /cpp/src/IcePatch2/Util.cpp | |
parent | added more tracing to trust manager stuff. (diff) | |
download | ice-e9c8c04c3c1a4fe8eac8576a4a7db52ce4b30052.tar.bz2 ice-e9c8c04c3c1a4fe8eac8576a4a7db52ce4b30052.tar.xz ice-e9c8c04c3c1a4fe8eac8576a4a7db52ce4b30052.zip |
Bug 1254
Diffstat (limited to 'cpp/src/IcePatch2/Util.cpp')
-rw-r--r-- | cpp/src/IcePatch2/Util.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index 652e088efd0..6959ab8d8d2 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -298,6 +298,11 @@ IcePatch2::simplify(const string& path) result.erase(pos, 2); } + while(result.substr(0, 4) == "/../") + { + result.erase(0, 3); + } + if(result.substr(0, 2) == "./") { result.erase(0, 2); @@ -324,6 +329,11 @@ IcePatch2::simplify(const string& path) result.erase(result.size() - 1); } + if(result == "/..") + { + result = "/"; + } + return result; } @@ -658,12 +668,15 @@ IcePatch2::createDirectoryRecursive(const string& pa) createDirectoryRecursive(dir); } - if(OS::mkdir(path, 0777) == -1) + if(!isRoot(path + "/")) { - if(errno != EEXIST) - { - throw "cannot create directory `" + path + "':\n" + lastError(); - } + if(OS::mkdir(path, 0777) == -1) + { + if(errno != EEXIST) + { + throw "cannot create directory `" + path + "':\n" + lastError(); + } + } } } |