diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/util.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/util.cc b/src/util.cc index dfae8d6..de535b3 100644 --- a/src/util.cc +++ b/src/util.cc @@ -138,18 +138,17 @@ bool CanonicalizePath(char* path, int* len, string* err) { continue; } - const char* sep = (const char*)memchr(src, '/', end - src); - if (sep == NULL) - sep = end; - if (component_count == kMaxPathComponents) Fatal("path has too many components"); components[component_count] = dst; ++component_count; + + const char* sep = (const char*)memchr(src, '/', end - src); + if (sep == NULL) + sep = end; while (src <= sep) { *dst++ = *src++; } - src = sep + 1; } |