commit bed72cf4090767585724ef77fc7efa978c88bd6d
Author: sin <[email protected]>
Date: Mon Apr 14 11:32:30 2014 +0100
Simplify skipping "." and ".." in switch_root
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 */