summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix/Path.cpp
diff options
context:
space:
mode:
authorAlkis Evlogimenos <alkis@evlogimenos.com>2004-12-13 07:41:35 +0000
committerAlkis Evlogimenos <alkis@evlogimenos.com>2004-12-13 07:41:35 +0000
commit5b1a05fb7c09ee9d8b085596e08683b78bc15222 (patch)
treef199e704b7e98578b45eba41b2688e9b48404c3c /llvm/lib/System/Unix/Path.cpp
parentc6de5b56a31231a2c5d20c128772233eb110f7a5 (diff)
downloadbcm5719-llvm-5b1a05fb7c09ee9d8b085596e08683b78bc15222.tar.gz
bcm5719-llvm-5b1a05fb7c09ee9d8b085596e08683b78bc15222.zip
Fix a bug where directory names of length one or less where not set
properly (examples: "", ".", "a"). llvm-svn: 18883
Diffstat (limited to 'llvm/lib/System/Unix/Path.cpp')
-rw-r--r--llvm/lib/System/Unix/Path.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/System/Unix/Path.cpp b/llvm/lib/System/Unix/Path.cpp
index e655ef40cdf..4b5ccb93448 100644
--- a/llvm/lib/System/Unix/Path.cpp
+++ b/llvm/lib/System/Unix/Path.cpp
@@ -290,7 +290,7 @@ Path::setDirectory(const std::string& a_path) {
Path save(*this);
path = a_path;
size_t last = a_path.size() -1;
- if (last != 0 && a_path[last] != '/')
+ if (a_path.size() == 0 || a_path[last] != '/')
path += '/';
if (!isValid()) {
path = save.path;
OpenPOWER on IntegriCloud