# HG changeset patch # User Olaf Wintermann # Date 1555836373 -7200 # Node ID 3f9a9c80a2d21b5bd93954cdc1fa13776569c635 # Parent caf23cf7f96d62f6dfe5847f338d8211aaf6ef71 fix that symlink config was not used in sync_get_resource diff -r caf23cf7f96d -r 3f9a9c80a2d2 dav/sync.c --- a/dav/sync.c Sun Apr 21 09:54:47 2019 +0200 +++ b/dav/sync.c Sun Apr 21 10:46:13 2019 +0200 @@ -1290,7 +1290,8 @@ LocalResource *local = ucx_map_cstr_get(db->resources, path); char *local_path = create_local_path(dir, path); - char *link = dav_get_string_property_ns(res, DAV_NS, "link"); + char *link = SYNC_SYMLINK(dir) ? + dav_get_string_property_ns(res, DAV_NS, "link") : NULL; char *etag = dav_get_string_property(res, "D:getetag"); SYS_STAT s; @@ -1299,7 +1300,7 @@ char *blocksize_str = dav_get_string_property_ns(res, DAV_NS, "split"); uint64_t blocksize = 0; DavBool issplit = FALSE; - if(blocksize_str) { + if(blocksize_str && !link) { if(!util_strtouint(blocksize_str, &blocksize)) { fprintf(stderr, "Error: split property does not contain an integer.\n"); return 1; @@ -1361,7 +1362,7 @@ } } - if(issplit || dir->hashing) { + if((issplit || dir->hashing) && !link) { if(truncate_file >= 0) { // only true if issplit is true if(truncate(local_path, truncate_file)) { @@ -1410,21 +1411,28 @@ if(local->etag) { free(local->etag); + local->etag = NULL; } if(local->hash) { free(local->hash); + local->hash = NULL; } if(local->link_target) { free(local->link_target); + local->link_target = NULL; } + stat_func statfn; if(link) { local->link_target = strdup(link); + statfn = sys_lstat; + } else { + statfn = sys_stat; } update_parts(local, part_updates, blockcount); - if(sys_stat(local_path, &s)) { + if(statfn(local_path, &s)) { fprintf(stderr, "Cannot stat file %s: %s\n", local_path, strerror(errno)); } diff -r caf23cf7f96d -r 3f9a9c80a2d2 dav/system.h --- a/dav/system.h Sun Apr 21 09:54:47 2019 +0200 +++ b/dav/system.h Sun Apr 21 10:46:13 2019 +0200 @@ -68,6 +68,8 @@ #define SYS_STAT struct stat #endif +typedef int(stat_func)(const char*, SYS_STAT *); + void sys_freedirent(SysDirEnt *ent); SYS_DIR sys_opendir(const char *path); SysDirEnt* sys_readdir(SYS_DIR dir);