343 int cmd_pull(CmdArgs *a) { |
343 int cmd_pull(CmdArgs *a) { |
344 if(a->argc != 1) { |
344 if(a->argc != 1) { |
345 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few" : "many"); |
345 fprintf(stderr, "Too %s arguments\n", a->argc < 1 ? "few" : "many"); |
346 return -1; |
346 return -1; |
347 } |
347 } |
348 |
|
349 // if there are syntax errors in the command line, fail asap. |
348 // if there are syntax errors in the command line, fail asap. |
350 SyncTagFilter* tagfilter = parse_tagfilter_string(cmd_getoption(a, "tags")); |
349 SyncTagFilter* tagfilter = parse_tagfilter_string(cmd_getoption(a, "tags")); |
351 if (!tagfilter) { |
350 if (!tagfilter) { |
352 fprintf(stderr, "Malformed tag filter\n"); |
351 fprintf(stderr, "Malformed tag filter\n"); |
353 return -1; |
352 return -1; |
739 local->etag = strdup(etag); |
737 local->etag = strdup(etag); |
740 local->last_modified = s.st_mtime; |
738 local->last_modified = s.st_mtime; |
741 local->size = s.st_size; |
739 local->size = s.st_size; |
742 local->skipped = FALSE; |
740 local->skipped = FALSE; |
743 } else { |
741 } else { |
744 if(unlink(tmp_path)) { |
742 if(sys_unlink(tmp_path)) { |
745 fprintf(stderr, "Cannot remove tmp file: %s\n", tmp_path); |
743 fprintf(stderr, "Cannot remove tmp file: %s\n", tmp_path); |
746 } |
744 } |
747 } |
745 } |
748 } |
746 } |
749 |
747 |
772 |
770 |
773 printf("delete: %s\n", res->path); |
771 printf("delete: %s\n", res->path); |
774 int ret = 0; |
772 int ret = 0; |
775 if(dir->trash) { |
773 if(dir->trash) { |
776 move_to_trash(dir, local_path); |
774 move_to_trash(dir, local_path); |
777 } else if(unlink(local_path)) { |
775 } else if(sys_unlink(local_path)) { |
778 fprintf(stderr, "Cannot remove file %s\n", local_path); |
776 fprintf(stderr, "Cannot remove file %s\n", local_path); |
779 ret = -2; |
777 ret = -2; |
780 } |
778 } |
781 free(local_path); |
779 free(local_path); |
782 |
780 |
1997 UcxMapIterator i = ucx_map_iterator(db->conflict); |
1995 UcxMapIterator i = ucx_map_iterator(db->conflict); |
1998 LocalResource *res; |
1996 LocalResource *res; |
1999 UCX_MAP_FOREACH(key, res, i) { |
1997 UCX_MAP_FOREACH(key, res, i) { |
2000 printf("delete: %s\n", res->path); |
1998 printf("delete: %s\n", res->path); |
2001 char *path = util_concat_path(dir->path, res->path); |
1999 char *path = util_concat_path(dir->path, res->path); |
2002 if(unlink(path)) { |
2000 if(sys_unlink(path)) { |
2003 if(errno != ENOENT) { |
2001 if(errno != ENOENT) { |
2004 perror("unlink"); |
2002 perror("unlink"); |
2005 num_err++; |
2003 num_err++; |
2006 } |
2004 } |
2007 } else { |
2005 } else { |