From 5d9e37f00fd8f3c0bc7b5b7abcf18d44c102904f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 20 Nov 2018 16:32:50 +0900 Subject: [PATCH] Add missing exceptions If the errno is ENOENT, the internal function returns PREFERENCE_ERROR_NO_KEY. Change-Id: I22f0df4ef804d3dbebca544203229574d49434b0 Signed-off-by: Hwankyu Jhun --- src/preference_inoti.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/preference_inoti.c b/src/preference_inoti.c index c8e10ce..92ad9fd 100644 --- a/src/preference_inoti.c +++ b/src/preference_inoti.c @@ -388,6 +388,8 @@ int _preference_kdb_del_notify(keynode_t *keynode) if (wd == -1) { strerror_r(errno, err_buf, sizeof(err_buf)); ERR("Error: inotify_add_watch() [%s]: %s", path, err_buf); + if (errno == ENOENT) + return PREFERENCE_ERROR_NO_KEY; return PREFERENCE_ERROR_IO_ERROR; } @@ -408,7 +410,10 @@ int _preference_kdb_del_notify(keynode_t *keynode) if (r == -1) { strerror_r(errno, err_buf, sizeof(err_buf)); ERR("Error: inotify_rm_watch [%s]: %s", keyname, err_buf); - func_ret = PREFERENCE_ERROR_IO_ERROR; + if (errno == ENOENT) + func_ret = PREFERENCE_ERROR_NO_KEY; + else + func_ret = PREFERENCE_ERROR_IO_ERROR; } INFO("key(%s) cb is removed. remained noti list total length(%d)", @@ -432,7 +437,7 @@ int _preference_kdb_del_notify(keynode_t *keynode) if (del == 0) { errno = ENOENT; - func_ret = PREFERENCE_ERROR_IO_ERROR; + func_ret = PREFERENCE_ERROR_NO_KEY; } return func_ret; -- 2.34.1