feat: add checksum-aware incremental sync

This commit is contained in:
2026-08-08 20:27:26 +02:00
parent e8e9436879
commit 2450b90dd0
20 changed files with 189 additions and 25 deletions
+12 -1
View File
@@ -105,11 +105,16 @@ FileMetadata* metadata_receive(int file_descriptor, int* ok) {
*ok = 0;
return NULL;
}
if (!present) {
if (present == 0) {
if (ok)
*ok = 1;
return NULL;
}
if (present != 1) {
if (ok)
*ok = 0;
return NULL;
}
FileMetadata* m = malloc(sizeof(FileMetadata));
if (m == NULL) {
if (ok)
@@ -156,6 +161,12 @@ FileMetadata* metadata_receive(int file_descriptor, int* ok) {
return NULL;
}
m->mtime_nsec = (long)mtime_nsec;
if (mtime_nsec < 0 || mtime_nsec >= 1000000000LL || mode < 0 || uid < 0 || gid < 0) {
free(m);
if (ok)
*ok = 0;
return NULL;
}
if (ok)
*ok = 1;
return m;