Simplify skipping "." and ".." in switch_root

This commit is contained in:
sin 2014-04-14 11:32:30 +01:00
parent 33be4f39c2
commit bed72cf409
1 changed files with 2 additions and 3 deletions

View File

@ -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 */