timezone: Fix compare_file comparison in timezone checking

Message ID 20250515114226.1456590-1-michael@amarulasolutions.com
State New
Headers show
Series
  • timezone: Fix compare_file comparison in timezone checking
Related show

Commit Message

Michael Nazzareno Trimarchi May 15, 2025, 11:42 a.m. UTC
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 <andrea.ricchi@amarulasolutions.com>
Signed-off-by: Michael Trimarchi <michael@amarulasolutions.com>
---
 src/timezone.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch

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)