[hackers] [ubase] Simplify skipping "." and ".." in switch_root || sin

From: <git_AT_suckless.org>
Date: Mon, 14 Apr 2014 12:33:03 +0200

commit bed72cf4090767585724ef77fc7efa978c88bd6d
Author: sin <sin_AT_2f30.org>
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
_AT_@ -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 */
Received on Mon Apr 14 2014 - 12:33:03 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 14 2014 - 12:36:16 CEST