From bed72cf4090767585724ef77fc7efa978c88bd6d Mon Sep 17 00:00:00 2001 From: sin Date: Mon, 14 Apr 2014 11:32:30 +0100 Subject: [PATCH] Simplify skipping "." and ".." in switch_root --- switch_root.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/switch_root.c b/switch_root.c index 388ccd4..cac24d6 100644 --- a/switch_root.c +++ b/switch_root.c @@ -28,9 +28,8 @@ delete_content(const char *dir, dev_t curdevice) if (d) { for(; (dent = readdir(d)) ;) { /* skip ".." and "." */ - if (dent->d_name[0] == '.' - && ((dent->d_name[1] == '.' && dent->d_name[2] == 0) - || (dent->d_name[1] == 0))) + if (strcmp(dent->d_name, ".") == 0 || + strcmp(dent->d_name, "..") == 0) continue; /* build path and dive deeper */