From d1fcf852969ed66a7b20687e126f387ee10914d6 Mon Sep 17 00:00:00 2001 From: juho Date: Wed, 26 Jun 2013 23:27:24 +0900 Subject: [PATCH] prevent resource leak closedir was missed. so add. Change-Id: Ib8a1ea11a06cf9bfbe21bf305619c3c935ef5de3 Signed-off-by: juho --- src/bs/bs.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/bs/bs.c b/src/bs/bs.c index 7972258..3eafbfa 100644 --- a/src/bs/bs.c +++ b/src/bs/bs.c @@ -378,30 +378,37 @@ static Ecore_File_Monitor_Cb __crash_file_cb(void *data, Ecore_File_Monitor *em, } return NULL; } + static int _get_file_count(char *path) { DIR *dir; struct dirent *dp; int count = 0; + dir = opendir(path); - if (!dir) return 0; + if (!dir) + return 0; while ((dp = readdir(dir)) != NULL) { const char *name = dp->d_name; /* always skip "." and ".." */ if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; + if (name[1] == 0) + continue; + if ((name[1] == '.') && (name[2] == 0)) + continue; } count++; } closedir(dir); return count; } + /* check disk available size */ static int _check_disk_available(void) { struct statfs lstatfs; int avail_size = 0; + if (statfs(CRASH_CHECK_DISK_PATH, &lstatfs) < 0) return -1; avail_size = (int)(lstatfs.f_bavail * (lstatfs.f_bsize/1024)); -- 2.7.4