Mon, 19 Aug 2013 14:23:00 +0200
added more error messages
dav/main.c | file | annotate | diff | comparison | revisions | |
dav/webdav.c | file | annotate | diff | comparison | revisions | |
dav/webdav.h | file | annotate | diff | comparison | revisions |
--- a/dav/main.c Mon Aug 19 12:50:42 2013 +0200 +++ b/dav/main.c Mon Aug 19 14:23:00 2013 +0200 @@ -595,7 +595,11 @@ if(sn->error = DAV_NOT_FOUND) { res = dav_resource_new(sn, path); } else { - fprintf(stderr, "error\n"); + if(sn->errorstr) { + fprintf(stderr, "Error: %s\n", sn->errorstr); + } else { + fprintf(stderr, "Error\n"); + } return -1; } } else if(res->iscollection) { @@ -634,6 +638,9 @@ if(dav_store(res)) { print_resource_error(sn, res->path); fprintf(stderr, "Cannot upload file.\n"); + if(sn->errorstr) { + fprintf(stderr, "%s\n", sn->errorstr); + } fclose(in); return -1; }
--- a/dav/webdav.c Mon Aug 19 12:50:42 2013 +0200 +++ b/dav/webdav.c Mon Aug 19 14:23:00 2013 +0200 @@ -113,6 +113,8 @@ return NULL; } DavSession *sn = malloc(sizeof(DavSession)); + sn->errorstr = NULL; + sn->error = CURLE_OK; if(url.ptr[url.length - 1] == '/') { sn->base_url = strdup(base_url); } else { @@ -186,6 +188,11 @@ } else { sn->error = DAV_ERROR; } + if(c != CURLE_OK) { + sn->errorstr = curl_easy_strerror(c); + } else { + sn->errorstr = NULL; + } } void dav_session_destroy(DavSession *sn) {