[PATCH v4 1/2] Revert "timezone: Fix compare_file comparison in timezone checking"

Andrea Ricchi <[email protected]> Thu, 5 Jun 2025 10:03:35 +0200
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
This reverts commit f20ccd19a62bd01aa117bfc8e7c388d2a16cde05.

`compare_file` is intended to work with symlinks, enabling
full and accurate matching between the requested timezone and the zoneinfo
database.
---
 src/timezone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/timezone.c b/src/timezone.c
index fba8b925..89c44895 100644
--- a/src/timezone.c
+++ b/src/timezone.c
@@ -124,8 +124,8 @@ static int compare_file(void *src_map, struct stat *src_st,
 
 	DBG("real path %s path name %s", real_path, pathname);
 
-	if (real_path && !g_strcmp0(real_path, pathname))
-		return 0;
+	if (real_path && g_strcmp0(real_path, pathname))
+		return -1;
 
 	fd = open(pathname, O_RDONLY | O_CLOEXEC);
 	if (fd < 0)
-- 
2.34.1