]> git.meshlink.io Git - meshlink/commitdiff
Fix deleting configuration directories with hidden files.
authorGuus Sliepen <guus@meshlink.io>
Sun, 6 Dec 2020 15:17:58 +0000 (16:17 +0100)
committerGuus Sliepen <guus@meshlink.io>
Sun, 6 Dec 2020 15:19:12 +0000 (16:19 +0100)
We incorrectly skipped files starting with a dot when deleting directories.
This is a problem on macOS, which might add .DS_Store files.

src/conf.c

index 1ed5ff614a73514ba6bbcfcbcffb1e1a579b8471..dd0761705ee0b3ff356d195500a4269b56299309 100644 (file)
@@ -79,7 +79,9 @@ static bool deltree(const char *dirname) {
 
                while((ent = readdir(d))) {
                        if(ent->d_name[0] == '.') {
 
                while((ent = readdir(d))) {
                        if(ent->d_name[0] == '.') {
-                               continue;
+                               if(!ent->d_name[1] || (ent->d_name[1] == '.' && !ent->d_name[2])) {
+                                       continue;
+                               }
                        }
 
                        char filename[PATH_MAX];
                        }
 
                        char filename[PATH_MAX];