[PATCH] timezone: Fix compare_file comparison in timezone checking

Michael Trimarchi <[email protected]> Thu, 15 May 2025 13:42:26 +0200
Newsgroups dev.linux.lists.connman
Message-ID <[email protected]>
The patch allow to compare file only when are not in the same
path. The compare_file is used to understand if the set timezone
if the same we are going to set

Signed-off-by: Andrea Ricchi <[email protected]>
Signed-off-by: Michael Trimarchi <[email protected]>
---
 src/timezone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/timezone.c b/src/timezone.c
index 89c44895..fba8b925 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 -1;
+	if (real_path && !g_strcmp0(real_path, pathname))
+		return 0;
 
 	fd = open(pathname, O_RDONLY | O_CLOEXEC);
 	if (fd < 0)
-- 
2.43.0