diff options
-rwxr-xr-x | preference/preference.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/preference/preference.c b/preference/preference.c index 558faf4..6e78b4e 100755 --- a/preference/preference.c +++ b/preference/preference.c @@ -1324,6 +1324,8 @@ API int preference_remove_all(void) dir = opendir(pref_dir_path); if (dir == NULL) { + if (errno == ENOENT) + return PREFERENCE_ERROR_NONE; strerror_r(errno, err_buf, sizeof(err_buf)); LOGE("opendir() failed. pref_path: %s, error: %d(%s)", pref_dir_path, errno, err_buf); return PREFERENCE_ERROR_IO_ERROR; @@ -1539,6 +1541,8 @@ API int preference_foreach_item(preference_item_cb callback, void *user_data) dir = opendir(pref_dir_path); if (dir == NULL) { + if (errno == ENOENT) + return PREFERENCE_ERROR_NONE; strerror_r(errno, err_buf, sizeof(err_buf)); LOGE("opendir() failed. path: %s, error: %d(%s)", pref_dir_path, errno, err_buf); return PREFERENCE_ERROR_IO_ERROR; |