- translated_target = link_target;
- if (reparse_tag == WIM_IO_REPARSE_TAG_MOUNT_POINT || is_absolute) {
- if (link_target_len < 7
- || memcmp(translated_target, "\\??\\", 4) != 0
- || translated_target[4] == '\0'
- || translated_target[5] != ':'
- || translated_target[6] != '\\') {
- ret = -EIO;
- goto out;
- }
- translated_target += 4;
- link_target_len -= 4;
- /* There's a drive letter, so just leave the backslashes since
- * it won't go anyhwere on UNIX anyway...
- *
- * XXX
- * NTFS-3g tries to re-map these links to actually point to
- * something, so maybe we could do something like that here
- * XXX*/
+ DEBUG("Interpeting substitute name \"%s\" (ReparseTag=0x%x)",
+ link_target, reparse_tag);
+ translate_slashes = true;
+ if (link_target_len >= 7 &&
+ link_target[0] == '\\' &&
+ link_target[1] == '?' &&
+ link_target[2] == '?' &&
+ link_target[3] == '\\' &&
+ link_target[4] != '\0' &&
+ link_target[5] == ':' &&
+ link_target[6] == '\\')
+ {
+ /* "Full" symlink or junction (\??\x:\ prefixed path) */
+ link_target += 6;
+ link_target_len -= 6;
+ } else if (reparse_tag == WIM_IO_REPARSE_TAG_MOUNT_POINT &&
+ link_target_len >= 12 &&
+ memcmp(link_target, "\\\\?\\Volume{", 11) == 0 &&
+ link_target[link_target_len - 1] == '\\')
+ {
+ /* Volume junction. Can't really do anything with it. */
+ translate_slashes = false;
+ } else if (reparse_tag == WIM_IO_REPARSE_TAG_SYMLINK &&
+ link_target_len >= 3 &&
+ link_target[0] != '\0' &&
+ link_target[1] == ':' &&
+ link_target[2] == '/')
+ {
+ /* "Absolute" symlink, with drive letter */
+ link_target += 2;
+ link_target_len -= 2;
+ } else if (reparse_tag == WIM_IO_REPARSE_TAG_SYMLINK &&
+ link_target_len >= 1)
+ {
+ if (link_target[0] == '/')
+ /* "Absolute" symlink, without drive letter */
+ ;
+ else
+ /* "Relative" symlink, without drive letter */
+ ;