# HG changeset patch # User Markus Mützel # Date 1661276656 -7200 # Node ID 4c38cf0ce06cf4a37a5eb37ec6f3235d5a62defd # Parent 6bcc5e6d77fef32f97ec341af9dd0aa0b741a1f4 canonicalize_file_name: Check root of potential mapped network drive (bug #62847). * liboctave/system/file-ops.cc (canonicalize_file_name): Make sure to compare with the canonicalized path corresponding to the root of the drive when checking if a file is on a mapped network drive. diff -r 6bcc5e6d77fe -r 4c38cf0ce06c liboctave/system/file-ops.cc --- a/liboctave/system/file-ops.cc Thu Aug 18 08:40:57 2022 +0200 +++ b/liboctave/system/file-ops.cc Tue Aug 23 19:44:16 2022 +0200 @@ -750,11 +750,12 @@ // If the initial path looked like a mapped network drive, replace // portion of path that corresponds to mapped root with drive root. - if (name.size () < 2 || name[1] != ':') + if (name.size () < 3 || name[1] != ':') return retval; // UNC path corresponding to original drive letter (mappped drive) - std::wstring orig_map = wname.substr (0, 2); + std::wstring orig_map = wname.substr (0, 3); + orig_map[2] = L'\\'; HANDLE h_map = CreateFileW (orig_map.c_str (), GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS