CVS commit by ossi: 

don't barf at directories with none of {tmp,new,cur}/ and turn them
into maildirs instead. see next commit.


  M +11 -6     drv_maildir.c   1.12


--- isync/src/drv_maildir.c  #1.11:1.12
@@ -213,5 +213,5 @@ maildir_validate( const char *prefix, co
        struct dirent *entry;
        time_t now;
-       int i, bl;
+       int i, j, bl;
        struct stat st;
        char buf[_POSIX_PATH_MAX];
@@ -226,4 +226,5 @@ maildir_validate( const char *prefix, co
                                        return DRV_STORE_BAD;
                                }
+                         mkdirs:
                                for (i = 0; i < 3; i++) {
                                        memcpy( buf + bl, subdirs[i], 4 );
@@ -244,11 +245,15 @@ maildir_validate( const char *prefix, co
                }
        } else {
-               for (i = 0; i < 3; i++) {
+               for (i = j = 0; i < 3; i++) {
                        memcpy( buf + bl, subdirs[i], 4 );
-                       if (stat( buf, &st ) || !S_ISDIR(st.st_mode)) {
+                       if (!stat( buf, &st ) && S_ISDIR(st.st_mode))
+                               j++;
+               }
+               if (!j)
+                       goto mkdirs;
+               if (j != 3) {
                                fprintf( stderr, "Maildir error: '%.*s' is no 
valid mailbox\n", bl, buf );
                                return DRV_BOX_BAD;
                        }
-               }
                memcpy( buf + bl, "tmp/", 5 );
                bl += 4;




-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to