]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
nfsdcltrack: skip "." and ".." when trying to clean out legacy recdir
authorJeff Layton <jlayton@redhat.com>
Wed, 28 Nov 2012 19:03:55 +0000 (14:03 -0500)
committerSteve Dickson <steved@redhat.com>
Wed, 28 Nov 2012 19:48:01 +0000 (14:48 -0500)
readdir picks up these two entries as "normal" dentries, but rmdir'ing
them won't work (and we wouldn't want to remove them anyway).

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/nfsdcltrack/nfsdcltrack.c

index 9801b9cd94a01d8041a78a532539ac62745e603d..4334340197b1dcea9228428f00272b7267defc18 100644 (file)
@@ -379,6 +379,17 @@ cltrack_legacy_gracedone(void)
        while ((entry = readdir(v4recovery))) {
                int len;
 
+               /* skip "." and ".." */
+               if (entry->d_name[0] == '.') {
+                       switch (entry->d_name[1]) {
+                       case '\0':
+                               continue;
+                       case '.':
+                               if (entry->d_name[2] == '\0')
+                                       continue;
+                       }
+               }
+
                /* borrow the clientid blob for this */
                len = snprintf((char *)blob, sizeof(blob), "%s/%s", dirname,
                                entry->d_name);