From f59559eadfc7d96864087dae8a32f782ca9bc6d9 Mon Sep 17 00:00:00 2001 From: "wn.jang" Date: Thu, 16 Apr 2020 14:09:34 +0900 Subject: [PATCH] Fix wrong initialize value Change-Id: I6889e8e2d3a8dcd1fccd66d2698707752c7064eb --- common/vc_config_mgr.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/common/vc_config_mgr.c b/common/vc_config_mgr.c index c8988a8..5d5fd12 100644 --- a/common/vc_config_mgr.c +++ b/common/vc_config_mgr.c @@ -63,8 +63,8 @@ static vc_config_s* g_config_info; static int g_lang_ref_count; static Ecore_Fd_Handler* g_fd_handler_lang = NULL; -static int g_fd_lang; -static int g_wd_lang; +static int g_fd_lang = -1; +static int g_wd_lang = -1; static GList* g_ino_list = NULL; @@ -577,12 +577,17 @@ Eina_Bool vc_config_mgr_inotify_event_cb(void* data, Ecore_Fd_Handler *fd_handle { SLOG(LOG_DEBUG, vc_config_tag(), "@@@ Config changed callback event"); + if (g_fd_lang < 0) { + SLOG(LOG_WARN, vc_config_tag(), "[WARN] FD for config file is closed"); + SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); + return ECORE_CALLBACK_PASS_ON; + } + int length; struct inotify_event event; memset(&event, '\0', sizeof(struct inotify_event)); length = read(g_fd_lang, &event, sizeof(struct inotify_event)); - if (0 > length) { SLOG(LOG_ERROR, vc_config_tag(), "[ERROR] Empty Inotify event"); SLOG(LOG_DEBUG, vc_config_tag(), "@@@"); @@ -1121,8 +1126,7 @@ int __vc_config_mgr_unregister_config_event() inotify_rm_watch(g_fd_lang, g_wd_lang); close(g_fd_lang); g_fd_handler_lang = NULL; - g_wd_lang = NULL; - g_fd_lang = NULL; + g_fd_lang = -1; vconf_ignore_key_changed(VCONFKEY_LANGSET, __vc_config_language_changed_cb); } -- 2.34.1