Wed, 02 Nov 2022 11:34:49 +0100
use sys_* io functions in dav put
dav/main.c | file | annotate | diff | comparison | revisions | |
dav/sync.c | file | annotate | diff | comparison | revisions | |
libidav/davqlexec.c | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Mon May 09 20:31:30 2022 +0200 +++ b/dav/main.c Wed Nov 02 11:34:49 2022 +0100 @@ -1212,8 +1212,8 @@ DavBool ignoredirerr) { int recursive = cmd_getoption(a, "recursive") ? 1 : 0; - struct stat s; - if(stat(file, &s)) { + SYS_STAT s; + if(sys_stat(file, &s)) { perror("stat"); fprintf(stderr, "cannot stat file %s\n", file); return -1; @@ -1237,19 +1237,19 @@ printf("mkcol: %s\n", file); } - DIR *dir = opendir(file); + SYS_DIR dir = sys_opendir(file); if(!dir) { // error } - struct dirent *entry; + SysDirEnt *entry; int nument = 0; - while((entry = readdir(dir)) != NULL) { - if(!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) { + while((entry = sys_readdir(dir)) != NULL) { + if(!strcmp(entry->name, ".") || !strcmp(entry->name, "..")) { continue; } nument++; - char *entry_file = util_concat_path(file, entry->d_name); - char *entry_path = util_concat_path(path, entry->d_name); + char *entry_file = util_concat_path(file, entry->name); + char *entry_path = util_concat_path(path, entry->name); int r = put_entry( repo, a, @@ -1267,7 +1267,7 @@ break; } } - closedir(dir); + sys_closedir(dir); if(nument == 0) { // create empty directory @@ -1287,7 +1287,7 @@ printf("put: %s\n", file); } - FILE *in = fopen(file, "rb"); + FILE *in = sys_fopen(file, "rb"); if(!in) { fprintf(stderr, "cannot open input file\n"); return -1;
--- a/dav/sync.c Mon May 09 20:31:30 2022 +0200 +++ b/dav/sync.c Wed Nov 02 11:34:49 2022 +0100 @@ -4340,7 +4340,8 @@ } } - int ret = -1; + int ret = -2; + dir->max_retry = 2; for(int i=0;i<=dir->max_retry;i++) { if(!exists && dav_create(res)) { continue;
--- a/libidav/davqlexec.c Mon May 09 20:31:30 2022 +0200 +++ b/libidav/davqlexec.c Wed Nov 02 11:34:49 2022 +0100 @@ -625,7 +625,7 @@ dav_set_effective_href(sn, root); // propfind request successful, now parse the response - char *url = "http://url/"; + char *url = "http://url/"; PropfindParser *parser = create_propfind_parser(rpbuf, url); if(!parser) { result.status = -1;