dav/sync.c

changeset 72
aac29f2e8030
parent 68
f6d3db6113d3
child 73
41e88442ad4e
equal deleted inserted replaced
71:c9aff0a0093d 72:aac29f2e8030
301 mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH; 301 mode_t mode = S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
302 if(util_mkdir(local_path, mode) && errno != EEXIST) { 302 if(util_mkdir(local_path, mode) && errno != EEXIST) {
303 ret = -1; 303 ret = -1;
304 } 304 }
305 } else { 305 } else {
306 FILE *out = fopen(local_path, "w"); 306 FILE *out = fopen(local_path, "wb");
307 if(!out) { 307 if(!out) {
308 fprintf(stderr, "Cannot open output file: %s\n", local_path); 308 fprintf(stderr, "Cannot open output file: %s\n", local_path);
309 free(local_path); 309 free(local_path);
310 return -1; 310 return -1;
311 } 311 }
667 } 667 }
668 668
669 669
670 int sync_put_resource(SyncDirectory *dir, DavResource *res, LocalResource *local) { 670 int sync_put_resource(SyncDirectory *dir, DavResource *res, LocalResource *local) {
671 char *local_path = util_concat_path(dir->path, res->path); 671 char *local_path = util_concat_path(dir->path, res->path);
672 FILE *in = fopen(local_path, "r"); 672 FILE *in = fopen(local_path, "rb");
673 if(!in) { 673 if(!in) {
674 fprintf(stderr, "Cannot open file %s\n", local_path); 674 fprintf(stderr, "Cannot open file %s\n", local_path);
675 free(local_path); 675 free(local_path);
676 return -1; 676 return -1;
677 } 677 }

mercurial