tDon't fail if a file doesn't exists - synk - synchronize files between hosts
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit e872191ae4694a75d961467620784755eae1d160
(DIR) parent 40270e60f6416f066c74fede12926f41b43b6070
(HTM) Author: Willy <willyatmailoodotorg>
Date: Sat, 3 Sep 2016 23:57:31 +0200
Don't fail if a file doesn't exists
Diffstat:
M synk.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
---
(DIR) diff --git a/synk.c b/synk.c
t@@ -205,14 +205,12 @@ getmetadata(const char *fn)
return NULL;
}
- if ((f = fopen(fn, "r")) == NULL) {
- log(LOG_ERROR, "%s: %s\n", fn, strerror(errno));;
- return NULL;
- }
-
memset(meta, 0, sizeof(struct metadata_t));
- sha512(f, meta->hash);
snprintf(meta->path, PATH_MAX, "%s", fn);
+ if ((f = fopen(fn, "r")) == NULL)
+ return meta;
+
+ sha512(f, meta->hash);
meta->mtime = gettimestamp(meta->path);
fclose(f);