From: Sunmin Lee Date: Fri, 4 Nov 2016 06:03:56 +0000 (+0900) Subject: util: bug fix for remove_dir_internal() X-Git-Tag: submit/tizen/20161108.022628~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f461960ef1fb6b4ba38b65cfde0ffacb3718b48d;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git 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 --- diff --git a/src/shared/util.c b/src/shared/util.c index 1b3412f0..6d3cf2a6 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;