synk

synchronize files between hosts
Log | Files | Refs | README | LICENSE

commit 5db306110bbecf1f8b8f7067ef64f244716af280
parent 0b4e0f2bd28198e42d8dd21df92bf3c0b37bf544
Author: Willy <willyatmailoodotorg>
Date:   Tue Aug 30 22:31:07 +0200

Add function to get metadata from a peer

Diffstat:
synk.c | 15+++++++++++++++
1 file changed, 15 insertions(+), 0 deletions(-)
diff --git a/synk.c b/synk.c @@ -255,9 +255,24 @@ getpeermeta(struct peer_t *clt, struct metadata_t local) return close(cfd); } + int +getmetadata(struct metadata_t *meta, const char *fn) { + FILE *f = NULL; + + if ((f = fopen(fn, "r")) == NULL) { + perror(fn); + return -1; + } + + sha512(f, meta->hash); + fclose(f); + snprintf(meta->path, PATH_MAX, "%s", fn); + meta->mtime = gettimestamp(meta->path); + return 0; +} }