isync

mailbox synchronization program
git clone https://git.code.sf.net/p/isync/isync
Log | Files | Refs | README | LICENSE

commit 3de16206e7368a8b4e436d16defb8fb429ceeda4
parent 24c57a244ee63ef0606f44a688edbf20e8d2eb04
Author: Oswald Buddenhagen <ossi@users.sf.net>
Date:   Fri,  9 Jan 2004 20:43:36 +0000

ignore anything that does not look remotely like a maildir when
collecting mailboxes for OneToOne.

Diffstat:
Msrc/main.c | 7+++++++
1 file changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -25,6 +25,7 @@ #include "isync.h" #include <sys/types.h> +#include <sys/stat.h> #include <stdlib.h> #include <unistd.h> #include <stdarg.h> @@ -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);