Modify login monitor implementation 47/304047/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 9 Jan 2024 10:35:22 +0000 (19:35 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Tue, 9 Jan 2024 11:09:10 +0000 (20:09 +0900)
The inotify watch callback function should return false if the file is matched.

Change-Id: I8c56cd45ab2583c4fee843c990c74ae21107aac8
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/amd_login_monitor.c

index d16b12fde97157ba6e0ed6ce4469e1a46f866f7f..ce69f94007229a87af3f3229d7ccbcba5b6d6637 100644 (file)
@@ -800,12 +800,12 @@ static gboolean __sd_login_monitor_init_cb(gpointer user_data)
 static bool __monitor_run_systemd_cb(const char *event_name, void *user_data)
 {
        if (event_name && !strcmp(event_name, FILE_USERS)) {
-               amd_inotify_rm_watch(login_monitor->users_watch_info);
                login_monitor->users_watch_info = NULL;
                if (__init_sd_login_monitor() < 0) {
                        _E("Failed to initialize login monitor");
                        g_timeout_add(1000, __sd_login_monitor_init_cb, NULL);
                }
+               return false;
        }
 
        return true;
@@ -831,9 +831,9 @@ static void __check_and_monitor_run_systemd_users(void)
 static bool __monitor_run_cb(const char *event_name, void *user_data)
 {
        if (event_name && !strcmp(event_name, FILE_SYSTEMD)) {
-               amd_inotify_rm_watch(login_monitor->systemd_watch_info);
                login_monitor->systemd_watch_info = NULL;
                __check_and_monitor_run_systemd_users();
+               return false;
        }
 
        return true;