summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2016-11-04 15:03:56 +0900
committerSunmin Lee <sunm.lee@samsung.com>2016-11-04 15:13:12 +0900
commitf461960ef1fb6b4ba38b65cfde0ffacb3718b48d (patch)
tree14079265bab44741efdb3b6d6897508517d9bbde
parent0706ef870d094025eeefb583cbca90a89ad35b0e (diff)
downloadcrash-worker-f461960ef1fb6b4ba38b65cfde0ffacb3718b48d.tar.gz
crash-worker-f461960ef1fb6b4ba38b65cfde0ffacb3718b48d.tar.bz2
crash-worker-f461960ef1fb6b4ba38b65cfde0ffacb3718b48d.zip
util: bug fix for remove_dir_internal()
In the remove_dir_internal(), it had not skipped dot directories (".", ".."). Fix this malfunction. Change-Id: Ie37b1e409380b2e0479538d4d3b67bbf27eebc26 Signed-off-by: Sunmin Lee <sunm.lee@samsung.com>
-rw-r--r--src/shared/util.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/shared/util.c b/src/shared/util.c
index 1b3412f..6d3cf2a 100644
--- a/src/shared/util.c
+++ b/src/shared/util.c
@@ -300,9 +300,7 @@ static int remove_dir_internal(int fd)
if (!dir)
return -1;
- if ((readdir_r(dir, &e, &de)) != 0)
- de = NULL;
- while (de) {
+ while ((ret = readdir_r(dir, &e, &de)) == 0 && de) {
if (de->d_type == DT_DIR) {
if (!strncmp(de->d_name, ".", 2) || !strncmp(de->d_name, "..", 3))
continue;