int q = 0; /*quotient*/
int r = 0; /*remainder*/
DIR *dp = NULL;
- struct dirent ep, *result;
+ struct dirent *ep;
struct stat fileinfo;
char abs_filename[FILENAME_MAX] = { 0, };
retvm_if(dirname == NULL, PMINFO_R_ERROR, "dirname is NULL");
return -1;
}
- for (ret = readdir_r(dp, &ep, &result);
- ret == 0 && result != NULL;
- ret = readdir_r(dp, &ep, &result)) {
- if (!strcmp(ep.d_name, ".") ||
- !strcmp(ep.d_name, "..")) {
+ for (ep = readdir(dp); ep != NULL; ep = readdir(dp)) {
+ if (!strcmp(ep->d_name, ".") ||
+ !strcmp(ep->d_name, "..")) {
continue;
}
snprintf(abs_filename, FILENAME_MAX, "%s/%s", dirname,
- ep.d_name);
+ ep->d_name);
if (lstat(abs_filename, &fileinfo) < 0)
perror(abs_filename);
else {
if (S_ISDIR(fileinfo.st_mode)) {
total += fileinfo.st_size;
- if (strcmp(ep.d_name, ".")
- && strcmp(ep.d_name, "..")) {
+ if (strcmp(ep->d_name, ".")
+ && strcmp(ep->d_name, "..")) {
ret = _pkgmgr_calculate_dir_size
(abs_filename);
total = total + ret;