commit afe44d4fdef3b9c592649917ddc16e9c74f5c371
Author: Oswald Buddenhagen <o...@kde.org>
Date:   Sat Aug 18 12:48:08 2012 +0200

    fix error handling of invalid SyncState *
    
    when we find that the store is incompatible with in-store sync state,
    we want to fail the whole channel. however, we must not claim that the
    store died, otherwise it won't be disposed of properly.

 src/isync.h |    7 ++++---
 src/main.c  |    4 +++-
 src/sync.c  |    2 +-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/isync.h b/src/isync.h
index a39ab21..9b23e50 100644
--- a/src/isync.h
+++ b/src/isync.h
@@ -451,9 +451,10 @@ extern const char *str_ms[2], *str_hl[2];
 
 #define SYNC_OK       0 /* assumed to be 0 */
 #define SYNC_FAIL     1
-#define SYNC_BAD(ms)  (2<<(ms))
-#define SYNC_NOGOOD   8 /* internal */
-#define SYNC_CANCELED 16 /* internal */
+#define SYNC_FAIL_ALL 2
+#define SYNC_BAD(ms)  (4<<(ms))
+#define SYNC_NOGOOD   16 /* internal */
+#define SYNC_CANCELED 32 /* internal */
 
 /* All passed pointers must stay alive until cb is called. */
 void sync_boxes( store_t *ctx[], const char *names[], channel_conf_t *chan,
diff --git a/src/main.c b/src/main.c
index 71470e6..a636ab1 100644
--- a/src/main.c
+++ b/src/main.c
@@ -746,11 +746,13 @@ done_sync( int sts, void *aux )
        if (sts) {
                mvars->ret = 1;
                if (sts & (SYNC_BAD(M) | SYNC_BAD(S))) {
-                       mvars->skip = 1;
                        if (sts & SYNC_BAD(M))
                                mvars->state[M] = ST_CLOSED;
                        if (sts & SYNC_BAD(S))
                                mvars->state[S] = ST_CLOSED;
+                       mvars->skip = 1;
+               } else if (sts & SYNC_FAIL_ALL) {
+                       mvars->skip = 1;
                }
        }
        sync_chans( mvars, E_SYNC );
diff --git a/src/sync.c b/src/sync.c
index 8f4d210..1503cff 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -647,7 +647,7 @@ box_selected( int sts, void *aux )
                if (!ctx[S]->path) {
                        error( "Error: store '%s' does not support in-box sync 
state\n", chan->stores[S]->name );
                  sbail:
-                       svars->ret = SYNC_BAD(S);
+                       svars->ret = SYNC_FAIL;
                        sync_bail2( svars );
                        return;
                }

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to