From bc2d8ee6a51c6584d292bc9c6fffe4b5e03eaefa Mon Sep 17 00:00:00 2001 From: Andrea Mazzoleni Date: Wed, 1 Dec 2021 18:00:07 +0100 Subject: [PATCH] Use proper locking when printing diff lines in Windows Windows requires a lock to avoid to mixup lines. --- cmdline/scan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cmdline/scan.c b/cmdline/scan.c index b5a3a38f..148ac0be 100644 --- a/cmdline/scan.c +++ b/cmdline/scan.c @@ -185,7 +185,7 @@ static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub, log_tag("scan:update:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer)); if (is_diff) { - printf("update %s\n", fmt_term(disk, slink->sub, esc_buffer)); + msg_info("update %s\n", fmt_term(disk, slink->sub, esc_buffer)); } /* update it */ @@ -202,7 +202,7 @@ static void scan_link(struct snapraid_scan* scan, int is_diff, const char* sub, log_tag("scan:add:%s:%s\n", disk->name, esc_tag(sub, esc_buffer)); if (is_diff) { - printf("add %s\n", fmt_term(disk, sub, esc_buffer)); + msg_info("add %s\n", fmt_term(disk, sub, esc_buffer)); } /* and continue to insert it */ @@ -784,7 +784,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, log_tag("scan:move:%s:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer), esc_tag(sub, esc_buffer_alt)); if (is_diff) { - printf("move %s -> %s\n", fmt_term(disk, file->sub, esc_buffer), fmt_term(disk, sub, esc_buffer_alt)); + msg_info("move %s -> %s\n", fmt_term(disk, file->sub, esc_buffer), fmt_term(disk, sub, esc_buffer_alt)); } /* remove from the name set */ @@ -947,7 +947,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, log_tag("scan:restore:%s:%s\n", disk->name, esc_tag(sub, esc_buffer)); if (is_diff) { - printf("restore %s\n", fmt_term(disk, sub, esc_buffer)); + msg_info("restore %s\n", fmt_term(disk, sub, esc_buffer)); } /* remove from the inode set */ @@ -1065,7 +1065,7 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, log_tag("scan:copy:%s:%s:%s:%s\n", other_disk->name, esc_tag(other_file->sub, esc_buffer), disk->name, esc_tag(file->sub, esc_buffer_alt)); if (is_diff) { - printf("copy %s -> %s\n", fmt_term(other_disk, other_file->sub, esc_buffer), fmt_term(disk, file->sub, esc_buffer_alt)); + msg_info("copy %s -> %s\n", fmt_term(other_disk, other_file->sub, esc_buffer), fmt_term(disk, file->sub, esc_buffer_alt)); } /* mark it as reported */ @@ -1090,14 +1090,14 @@ static void scan_file(struct snapraid_scan* scan, int is_diff, const char* sub, ); if (is_diff) { - printf("update %s\n", fmt_term(disk, sub, esc_buffer)); + msg_info("update %s\n", fmt_term(disk, sub, esc_buffer)); } } else { ++scan->count_insert; log_tag("scan:add:%s:%s\n", disk->name, esc_tag(sub, esc_buffer)); if (is_diff) { - printf("add %s\n", fmt_term(disk, sub, esc_buffer)); + msg_info("add %s\n", fmt_term(disk, sub, esc_buffer)); } } } @@ -1671,7 +1671,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff) log_tag("scan:remove:%s:%s\n", disk->name, esc_tag(file->sub, esc_buffer)); if (is_diff) { - printf("remove %s\n", fmt_term(disk, file->sub, esc_buffer)); + msg_info("remove %s\n", fmt_term(disk, file->sub, esc_buffer)); } scan_file_remove(scan, file); @@ -1692,7 +1692,7 @@ static int state_diffscan(struct snapraid_state* state, int is_diff) log_tag("scan:remove:%s:%s\n", disk->name, esc_tag(slink->sub, esc_buffer)); if (is_diff) { - printf("remove %s\n", fmt_term(disk, slink->sub, esc_buffer)); + msg_info("remove %s\n", fmt_term(disk, slink->sub, esc_buffer)); } scan_link_remove(scan, slink);