CVS commit by ossi: 

make the sync entry search in the journal replay wrap around at the end
of the list. the "always forward" assumption is violated in some cases.


  M +70 -75    sync.c   1.65


--- isync/src/sync.c  #1.64:1.65
@@ -310,6 +310,6 @@ sync_boxes( store_t *ctx[], const char *
                if (!stat( nname, &st )) {
                        debug( "recovering journal ...\n" );
+                       srec = 0;
                        line = 0;
-                       srec = recs;
                        while (fgets( buf, sizeof(buf), jfp )) {
                                line++;
@@ -320,7 +320,4 @@ sync_boxes( store_t *ctx[], const char *
                                        goto bail;
                                }
-                               if (buf[0] == '^')
-                                       srec = recs;
-                               else {
                                        if (buf[0] == '(' || buf[0] == ')' ?
                                                (sscanf( buf + 2, "%d", &t1 ) 
!= 1) :
@@ -353,5 +350,8 @@ sync_boxes( store_t *ctx[], const char *
                                                srecadd = &srec->next;
                                        } else {
-                                               for (; srec; srec = srec->next)
+                                       for (nsrec = srec; srec; srec = 
srec->next)
+                                               if (srec->uid[M] == t1 && 
srec->uid[S] == t2)
+                                                       goto syncfnd;
+                                       for (srec = recs; srec != nsrec; srec = 
srec->next)
                                                        if (srec->uid[M] == t1 
&& srec->uid[S] == t2)
                                                                goto syncfnd;
@@ -397,5 +397,4 @@ sync_boxes( store_t *ctx[], const char *
                                }
                        }
-               }
                fclose( jfp );
        } else {
@@ -512,5 +511,4 @@ sync_boxes( store_t *ctx[], const char *
                }
                debug( "  min non-orphaned master uid is %d\n", minwuid );
-               Fprintf( jfp, "^\n" ); /* if any S_EXP_S */
                for (srec = recs; srec; srec = srec->next) {
                        if (srec->status & S_DEAD)
@@ -651,5 +649,4 @@ sync_boxes( store_t *ctx[], const char *
 
        debug( "synchronizing old entries\n" );
-       Fprintf( jfp, "^\n" );
        for (srec = recs; srec != *osrecadd; srec = srec->next) {
                if (srec->status & (S_DEAD|S_DONE))
@@ -779,5 +776,4 @@ sync_boxes( store_t *ctx[], const char *
                }
                if (delt) {
-                       Fprintf( jfp, "^\n" );
                        for (srec = recs; srec; srec = srec->next) {
                                if (srec->status & (S_DEAD|S_EXPIRED))
@@ -869,5 +865,4 @@ sync_boxes( store_t *ctx[], const char *
                }
 
-               Fprintf( jfp, "^\n" );
                for (srec = recs; srec; srec = srec->next) {
                        if (srec->status & S_DEAD)




-------------------------------------------------------
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