ignore anything that does not look remotely like a maildir when

collecting mailboxes for OneToOne.
This commit is contained in:
Oswald Buddenhagen 2004-01-09 20:43:36 +00:00
parent 24c57a244e
commit 3de16206e7

View File

@ -25,6 +25,7 @@
#include "isync.h" #include "isync.h"
#include <sys/types.h> #include <sys/types.h>
#include <sys/stat.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <stdarg.h> #include <stdarg.h>
@ -334,10 +335,16 @@ main (int argc, char **argv)
return 1; return 1;
} }
while ((de = readdir (dir))) { while ((de = readdir (dir))) {
struct stat st;
char buf[PATH_MAX];
if (*de->d_name == '.') if (*de->d_name == '.')
continue; continue;
if (global.inbox && !strcmp (global.inbox, de->d_name)) if (global.inbox && !strcmp (global.inbox, de->d_name))
continue; 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)); box = malloc (sizeof (config_t));
memcpy (box, &global, sizeof (config_t)); memcpy (box, &global, sizeof (config_t));
box->path = strdup (de->d_name); box->path = strdup (de->d_name);