diff --git a/csync/src/csync_update.c b/csync/src/csync_update.c index 88cfe023e..f5b010ef0 100644 --- a/csync/src/csync_update.c +++ b/csync/src/csync_update.c @@ -309,6 +309,7 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, checksumIdentical = strncmp(st->checksum, tmp->checksum, 1000) == 0; } if (checksumIdentical) { + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "NOTE: Checksums are identical, file did not actually change: %s", path); st->instruction = CSYNC_INSTRUCTION_NONE; st->should_update_metadata = true; goto out; @@ -555,7 +556,11 @@ int csync_walker(CSYNC *ctx, const char *file, const csync_vio_file_stat_t *fs, switch (flag) { case CSYNC_FTW_FLAG_FILE: if (ctx->current == REMOTE_REPLICA) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size); + if (fs->fields & CSYNC_VIO_FILE_STAT_FIELDS_SIZE) { + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=%" PRIu64 "]", file, fs->file_id, fs->size); + } else { + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [file_id=%s size=UNKNOWN]", file, fs->file_id); + } } else { CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s [inode=%" PRIu64 " size=%" PRIu64 "]", file, fs->inode, fs->size); } diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 29b4c223e..c85fe2d3c 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -258,8 +258,12 @@ static csync_vio_file_stat_t* propertyMapToFileStat(const QMap file_stat->mtime = oc_httpdate_parse(value.toUtf8()); file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_MTIME; } else if (property == "getcontentlength") { - file_stat->size = value.toLongLong(); - file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE; + bool ok = false; + qlonglong ll = value.toLongLong(&ok); + if (ok && ll >= 0) { + file_stat->size = ll; + file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_SIZE; + } } else if (property == "getetag") { file_stat->etag = csync_normalize_etag(value.toUtf8()); file_stat->fields |= CSYNC_VIO_FILE_STAT_FIELDS_ETAG;