commit | 4bc35daaa2ebfb099b2f912ca67e77bd8e98fbb7 | [log] [tgz] |
---|---|---|
author | Keisuke Kuroyanagi <ksk@google.com> | Wed Mar 12 15:31:49 2014 +0900 |
committer | Keisuke Kuroyanagi <ksk@google.com> | Wed Mar 12 15:31:49 2014 +0900 |
tree | 9b7fd13ddad29bbfa76082bfdab262c8931ac76a | |
parent | 5dc17c22ca88cf1dcf2225d8b252bcfa8c84d364 [diff] |
Check "." and ".." to delete all files in a dir. Bug: 13421999 Change-Id: I9d0f65cfc9a0f18c7affc152a5b54f9970048e9c
diff --git a/native/jni/src/suggest/policyimpl/dictionary/utils/file_utils.cpp b/native/jni/src/suggest/policyimpl/dictionary/utils/file_utils.cpp index 9441a75..fb80f38 100644 --- a/native/jni/src/suggest/policyimpl/dictionary/utils/file_utils.cpp +++ b/native/jni/src/suggest/policyimpl/dictionary/utils/file_utils.cpp
@@ -68,6 +68,9 @@ if (dirent->d_type == DT_DIR) { continue; } + if (strcmp(dirent->d_name, ".") == 0 || strcmp(dirent->d_name, "..") == 0) { + continue; + } const int filePathBufSize = getFilePathBufSize(dirPath, dirent->d_name); char filePath[filePathBufSize]; getFilePath(dirPath, dirent->d_name, filePathBufSize, filePath);