735 if(dir->hashing) { |
735 if(dir->hashing) { |
736 // check for moved/copied files |
736 // check for moved/copied files |
737 UcxList *elm = res_new; |
737 UcxList *elm = res_new; |
738 UcxList *prev = NULL; |
738 UcxList *prev = NULL; |
739 UcxList *next = NULL; |
739 UcxList *next = NULL; |
740 struct stat s; |
740 SYS_STAT s; |
741 for(;elm;elm=next) { |
741 for(;elm;elm=next) { |
742 DavResource *res = elm->data; |
742 DavResource *res = elm->data; |
743 prev = elm->prev; |
743 prev = elm->prev; |
744 next = elm->next; |
744 next = elm->next; |
745 |
745 |
843 char *local_path = create_local_path(dir, res->path); |
843 char *local_path = create_local_path(dir, res->path); |
844 if(sync_store_metadata(dir, local_path, local, res)) { |
844 if(sync_store_metadata(dir, local_path, local, res)) { |
845 fprintf(stderr, "Metadata update failed: %s\n", res->path); |
845 fprintf(stderr, "Metadata update failed: %s\n", res->path); |
846 sync_error++; |
846 sync_error++; |
847 } else { |
847 } else { |
848 struct stat s; |
848 SYS_STAT s; |
849 if(stat(local_path, &s)) { |
849 if(sys_stat(local_path, &s)) { |
850 fprintf(stderr, "Cannot stat file after update: %s\n", strerror(errno)); |
850 fprintf(stderr, "Cannot stat file after update: %s\n", strerror(errno)); |
851 } |
851 } |
852 sync_set_metadata_from_stat(local, &s); |
852 sync_set_metadata_from_stat(local, &s); |
853 sync_success++; |
853 sync_success++; |
854 } |
854 } |
1064 |
1064 |
1065 free(local_path); |
1065 free(local_path); |
1066 return ret; |
1066 return ret; |
1067 } |
1067 } |
1068 |
1068 |
1069 void sync_set_metadata_from_stat(LocalResource *local, struct stat *s) { |
1069 void sync_set_metadata_from_stat(LocalResource *local, SYS_STAT *s) { |
1070 local->last_modified = s->st_mtime; |
1070 local->last_modified = s->st_mtime; |
1071 local->mode = s->st_mode & 07777; |
1071 local->mode = s->st_mode & 07777; |
1072 local->uid = s->st_uid; |
1072 local->uid = s->st_uid; |
1073 local->gid = s->st_gid; |
1073 local->gid = s->st_gid; |
1074 local->size = s->st_size; |
1074 local->size = s->st_size; |