Skip to content

Commit

Permalink
[PosixTimezone][webOS] Use realpath to resolve localtime path
Browse files Browse the repository at this point in the history
On webOS /etc/localtime is a symlink to /var/luna/preferences/localtime which in turn is another symlink to the real timezone file. In this case the timezone file must be resolved twice which realpath does
  • Loading branch information
sundermann committed Oct 3, 2023
1 parent 3c30614 commit 6e4793f
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions xbmc/platform/posix/PosixTimezone.cpp
Expand Up @@ -216,12 +216,9 @@ std::string CPosixTimezone::GetOSConfiguredTimezone()
std::string CPosixTimezone::ReadFromLocaltime(const std::string_view filename)
{
char path[PATH_MAX];
ssize_t len = readlink(filename.data(), path, sizeof(path) - 1);

if (len == -1)
if(realpath(filename.data(), path) == nullptr)
return "";

path[len] = '\0';
// Read the timezone starting from the second last occurrence of /
std::string str = path;
size_t pos = str.rfind('/');
Expand Down

0 comments on commit 6e4793f

Please sign in to comment.