From: Jeff Layton Date: Wed, 28 Nov 2012 19:03:55 +0000 (-0500) Subject: nfsdcltrack: skip "." and ".." when trying to clean out legacy recdir X-Git-Tag: debian/1%1.2.8-1~11^2^2~51 X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=commitdiff_plain;h=bf64ebb2faaba0666068c502353fb0c49c23c756;hp=5dfc6e239102e3a957c102f0ad194992361b3dc4 nfsdcltrack: skip "." and ".." when trying to clean out legacy recdir 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 Signed-off-by: Steve Dickson --- diff --git a/utils/nfsdcltrack/nfsdcltrack.c b/utils/nfsdcltrack/nfsdcltrack.c index 9801b9c..4334340 100644 --- a/utils/nfsdcltrack/nfsdcltrack.c +++ b/utils/nfsdcltrack/nfsdcltrack.c @@ -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);