From 3de16206e7368a8b4e436d16defb8fb429ceeda4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 9 Jan 2004 20:43:36 +0000 Subject: [PATCH] ignore anything that does not look remotely like a maildir when collecting mailboxes for OneToOne. --- src/main.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.c b/src/main.c index 2cd0273..c2b01d6 100644 --- a/src/main.c +++ b/src/main.c @@ -25,6 +25,7 @@ #include "isync.h" #include +#include #include #include #include @@ -334,10 +335,16 @@ main (int argc, char **argv) return 1; } while ((de = readdir (dir))) { + struct stat st; + char buf[PATH_MAX]; + if (*de->d_name == '.') continue; if (global.inbox && !strcmp (global.inbox, de->d_name)) continue; + snprintf (buf, sizeof(buf), "%s/%s/cur", global.maildir, de->d_name); + if (stat (buf, &st) || !S_ISDIR (st.st_mode)) + continue; box = malloc (sizeof (config_t)); memcpy (box, &global, sizeof (config_t)); box->path = strdup (de->d_name);