Sat, 10 Aug 2019 19:54:37 +0200
change error handling in case of file/folder conflict
dav/sync.c | file | annotate | diff | comparison | revisions |
--- a/dav/sync.c Sat Aug 10 19:34:49 2019 +0200 +++ b/dav/sync.c Sat Aug 10 19:54:37 2019 +0200 @@ -980,8 +980,8 @@ } else if(local && S_ISDIR(s.st_mode)) { local->isdirectory = 1; // make sure isdirectory is set } else { - // TODO: conflict - ret = REMOTE_NO_CHANGE; + // set change to REMOTE_CHANGE_MKDIR, which will fail later + ret = REMOTE_CHANGE_MKDIR; } } else if(local) { DavBool nochange = FALSE; @@ -1481,7 +1481,7 @@ char *res_path = resource_local_path(res); char *local_path = create_local_path(dir, res->path); free(res_path); - + printf("get: %s\n", res->path); // create directory // ignore error if it already exists @@ -1492,13 +1492,15 @@ free(local_path); return 1; } + + // stat for getting metadata SYS_STAT s; if(sys_stat(local_path, &s)) { fprintf(stderr, "Cannot stat directory %s: %s", local_path, strerror(errno)); free(local_path); return 1; } - + // if it doesn't exist in the db, create an entry for the dir LocalResource *local = ucx_map_cstr_get(db->resources, res->path); if(!local) {