Add missing exceptions 99/193399/2
authorHwankyu Jhun <h.jhun@samsung.com>
Tue, 20 Nov 2018 07:32:50 +0000 (16:32 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 20 Nov 2018 23:30:13 +0000 (23:30 +0000)
If the errno is ENOENT, the internal function returns
PREFERENCE_ERROR_NO_KEY.

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

index c8e10cee3e1f2f02c262c38be0e68d5e56f85d9a..92ad9fd305cf6d0905dd6a133fbdfe94d5c0c8d4 100644 (file)
@@ -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;