diff --git a/src/csync.c b/src/csync.c index 4eac02cbad..274ca4625d 100644 --- a/src/csync.c +++ b/src/csync.c @@ -211,8 +211,9 @@ int csync_init(CSYNC *ctx) { /* create/load journal */ if (! csync_is_journal_disabled(ctx)) { - if (asprintf(&ctx->journal.file, "%s/csync_journal_%llu.db", ctx->options.config_dir, - c_jhash64((uint8_t *) ctx->remote.uri, strlen(ctx->remote.uri), 0)) < 0) { + uint64_t h = c_jhash64((uint8_t *) ctx->remote.uri, strlen(ctx->remote.uri), 0); + if (asprintf(&ctx->journal.file, "%s/csync_journal_%llu.db", + ctx->options.config_dir, (long long unsigned int) h) < 0) { rc = -1; goto out; } @@ -473,7 +474,7 @@ int csync_destroy(CSYNC *ctx) { jwritten = 1; clock_gettime(CLOCK_REALTIME, &finish); CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, - "Writing the journal of %llu files to disk took %.2f seconds", + "Writing the journal of %lu files to disk took %.2f seconds", c_rbtree_size(ctx->local.tree), c_secdiff(finish, start)); } else { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "Unable to write journal: %s", diff --git a/src/csync_journal.c b/src/csync_journal.c index 3a707222fa..7047e9766e 100644 --- a/src/csync_journal.c +++ b/src/csync_journal.c @@ -432,7 +432,7 @@ c_strlist_t *csync_journal_query(CSYNC *ctx, const char *statement) { if (busy_count) { /* sleep 100 msec */ usleep(100000); - CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "sqlite3_prepare: BUSY counter: %d", busy_count); + CSYNC_LOG(CSYNC_LOG_PRIORITY_DEBUG, "sqlite3_prepare: BUSY counter: %zu", busy_count); } err = sqlite3_prepare(ctx->journal.db, statement, -1, &stmt, &tail); } while (err == SQLITE_BUSY && busy_count ++ < 120); @@ -458,7 +458,7 @@ c_strlist_t *csync_journal_query(CSYNC *ctx, const char *statement) { } /* sleep 100 msec */ usleep(100000); - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "sqlite3_step: BUSY counter: %d", busy_count); + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "sqlite3_step: BUSY counter: %zu", busy_count); continue; } diff --git a/src/csync_propagate.c b/src/csync_propagate.c index f62305399a..40d33ca919 100644 --- a/src/csync_propagate.c +++ b/src/csync_propagate.c @@ -184,7 +184,7 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) { if (bwritten < 0 || bread != bwritten) { CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, - "file: %s, command: write, error: bread = %d, bwritten = %d - %s", + "file: %s, command: write, error: bread = %zu, bwritten = %zu - %s", duri, bread, bwritten, strerror(errno)); rc = 1; goto out; @@ -224,7 +224,7 @@ static int _csync_push_file(CSYNC *ctx, csync_file_stat_t *st) { } if (st->size != tstat->size) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "file: %s, error: incorrect filesize (size: %d should be %d)", turi, tstat->size, st->size); + CSYNC_LOG(CSYNC_LOG_PRIORITY_ERROR, "file: %s, error: incorrect filesize (size: %zu should be %zu)", turi, tstat->size, st->size); rc = 1; goto out; } diff --git a/src/csync_update.c b/src/csync_update.c index 8a44d8466a..454a3ee41b 100644 --- a/src/csync_update.c +++ b/src/csync_update.c @@ -81,8 +81,8 @@ static int _csync_detect_update(CSYNC *ctx, const char *file, const csync_vio_fi if (st == NULL) { return -1; } - CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - hash %llu, st size: %d", - path, h, size); + CSYNC_LOG(CSYNC_LOG_PRIORITY_TRACE, "file: %s - hash %llu, st size: %zu", + path, (long long unsigned int) h, size); /* check hardlink count */ if (type == CSYNC_FTW_TYPE_FILE && fs->nlink > 1) { diff --git a/tests/log_tests/check_log.c b/tests/log_tests/check_log.c index 481da7ada4..590ee7ee23 100644 --- a/tests/log_tests/check_log.c +++ b/tests/log_tests/check_log.c @@ -47,7 +47,8 @@ END_TEST START_TEST (log_null) { - CSYNC_LOG(CSYNC_LOG_PRIORITY_UNKNOWN, "log %s", NULL); + char *z = NULL; + CSYNC_LOG(CSYNC_LOG_PRIORITY_UNKNOWN, "log %s", z); } END_TEST