diff -r 99f7816fcf01 -r 3c1ce5f203d7 dav/sync.c --- a/dav/sync.c Mon Aug 04 14:33:56 2014 +0200 +++ b/dav/sync.c Tue Aug 05 13:05:03 2014 +0200 @@ -401,12 +401,13 @@ read_changes(dir, db) : local_scan(dir, db); UCX_FOREACH(elm, resources) { - char *path = elm->data; - printf("put: %s\n", path); - DavResource *res = dav_resource_new(sn, path); - sync_put_resource(dir, res, db); + LocalResource *local_res = elm->data; + printf("put: %s\n", local_res->path); + DavResource *res = dav_resource_new(sn, local_res->path); + if(!sync_put_resource(dir, res, db)) { + ucx_map_cstr_put(db->resources, local_res->path, local_res); + } dav_resource_free(res); - free(path); } ucx_list_free(resources); @@ -467,7 +468,7 @@ if(isdir) { stack = ucx_list_prepend(stack, new_path); } else if(res) { - resources = ucx_list_append(resources, strdup(res->path)); + resources = ucx_list_append(resources, res); free(new_path); } else { free(new_path); @@ -515,7 +516,7 @@ int isdir; LocalResource *res = path_to_local_resource(dir, db, value.ptr, &isdir); if(res) { - resources = ucx_list_append(resources, strdup(res->path)); + resources = ucx_list_append(resources, res); } } else if(!sstrcmp(name, S("remove"))) { int isdir; @@ -572,7 +573,7 @@ res->etag = NULL; res->last_modified = s.st_mtime; res->size = s.st_size; - ucx_map_cstr_put(db->resources, res->path, res); + //ucx_map_cstr_put(db->resources, res->path, res); return res; } } else {