Fix getting the Absolute path while looking up the TZ files (#17711)
authorTarek Mahmoud Sayed <tarekms@microsoft.com>
Sat, 21 Apr 2018 06:05:27 +0000 (23:05 -0700)
committerJan Kotas <jkotas@microsoft.com>
Sat, 21 Apr 2018 06:05:27 +0000 (23:05 -0700)
src/mscorlib/shared/System/TimeZoneInfo.Unix.cs

index f619be2..920131d 100644 (file)
@@ -384,8 +384,8 @@ namespace System
             string symlinkPath = Interop.Sys.ReadLink(tzFilePath);
             if (symlinkPath != null)
             {
-                // Use Path.Combine to resolve links that contain a relative path (e.g. /etc/localtime).
-                symlinkPath = Path.Combine(tzFilePath, symlinkPath);
+                // symlinkPath can be relative path, use Path to get the full absolute path.
+                symlinkPath = Path.GetFullPath(symlinkPath, Path.GetDirectoryName(tzFilePath));
 
                 string timeZoneDirectory = GetTimeZoneDirectory();
                 if (symlinkPath.StartsWith(timeZoneDirectory, StringComparison.Ordinal))