Fix normalize_path's handling of "/.."
Currently it normalizes the path to a string with a single uninitialized
byte. It should instead normalize it to "/".
Bug: none
Test: /data/nativetest/linker-unit-tests/linker-unit-tests32
Test: /data/nativetest64/linker-unit-tests/linker-unit-tests64
Change-Id: I06e0f7598d16acfa21875dad53efbc293cfeb44d
diff --git a/linker/linker_utils.cpp b/linker/linker_utils.cpp
index 789d5c1..6b9aec9 100644
--- a/linker/linker_utils.cpp
+++ b/linker/linker_utils.cpp
@@ -98,8 +98,8 @@
while (out_ptr > buf && *--out_ptr != '/') {
}
if (in_ptr[0] == 0) {
- // retain '/'
- out_ptr++;
+ // retain '/' (or write the initial '/' for "/..")
+ *out_ptr++ = '/';
}
continue;
}