int _app2sd_delete_directory(const char *dirname)
{
DIR *dp = NULL;
- struct dirent ep;
- struct dirent *er = NULL;
+ struct dirent *ep = NULL;
char abs_filename[FILENAME_MAX] = { 0, };
int ret = 0;
dp = opendir(dirname);
if (dp != NULL) {
- while (readdir_r(dp, &ep, &er) == 0 && er != NULL) {
+ while ((ep = readdir(dp)) != NULL) {
struct stat stFileInfo;
snprintf(abs_filename, FILENAME_MAX, "%s/%s", dirname,
- ep.d_name);
+ ep->d_name);
if (lstat(abs_filename, &stFileInfo) < 0) {
perror(abs_filename);
}
if (S_ISDIR(stFileInfo.st_mode)) {
- if (strcmp(ep.d_name, ".")
- && strcmp(ep.d_name, "..")) {
+ if (strcmp(ep->d_name, ".")
+ && strcmp(ep->d_name, "..")) {
ret = _app2sd_delete_directory(abs_filename);
if (ret < 0) {
(void)closedir(dp);