Skip to content

Commit

Permalink
Use proper locking when printing diff lines in Windows
Browse files Browse the repository at this point in the history
Windows requires a lock to avoid to mixup lines.
  • Loading branch information
amadvance committed Dec 1, 2021
1 parent 2c3f9b8 commit bc2d8ee
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cmdline/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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 */
Expand All @@ -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));
}
}
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit bc2d8ee

Please sign in to comment.