diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c index 77b9da6aad..8884ac536a 100644 --- a/lib/libzfs/libzfs_diff.c +++ b/lib/libzfs/libzfs_diff.c @@ -51,9 +51,9 @@ #define ZDIFF_PREFIX "zfs-diff-%d" #define ZDIFF_ADDED '+' -#define ZDIFF_MODIFIED 'M' +#define ZDIFF_MODIFIED "M" #define ZDIFF_REMOVED '-' -#define ZDIFF_RENAMED 'R' +#define ZDIFF_RENAMED "R" /* @@ -180,16 +180,13 @@ print_rename(FILE *fp, differ_info_t *di, const char *old, const char *new, (void) fprintf(fp, "%10lld.%09lld\t", (longlong_t)isb->zs_ctime[0], (longlong_t)isb->zs_ctime[1]); - (void) fprintf(fp, "%c\t", ZDIFF_RENAMED); + (void) fputs(ZDIFF_RENAMED "\t", fp); if (di->classify) (void) fprintf(fp, "%c\t", get_what(isb->zs_mode)); print_cmn(fp, di, old); - if (di->scripted) - (void) fprintf(fp, "\t"); - else - (void) fprintf(fp, " -> "); + (void) fputs(di->scripted ? "\t" : " -> ", fp); print_cmn(fp, di, new); - (void) fprintf(fp, "\n"); + (void) fputc('\n', fp); } static void @@ -200,12 +197,11 @@ print_link_change(FILE *fp, differ_info_t *di, int delta, const char *file, (void) fprintf(fp, "%10lld.%09lld\t", (longlong_t)isb->zs_ctime[0], (longlong_t)isb->zs_ctime[1]); - (void) fprintf(fp, "%c\t", ZDIFF_MODIFIED); + (void) fputs(ZDIFF_MODIFIED "\t", fp); if (di->classify) (void) fprintf(fp, "%c\t", get_what(isb->zs_mode)); print_cmn(fp, di, file); - (void) fprintf(fp, "\t(%+d)", delta); - (void) fprintf(fp, "\n"); + (void) fprintf(fp, "\t(%+d)\n", delta); } static void @@ -220,7 +216,7 @@ print_file(FILE *fp, differ_info_t *di, char type, const char *file, if (di->classify) (void) fprintf(fp, "%c\t", get_what(isb->zs_mode)); print_cmn(fp, di, file); - (void) fprintf(fp, "\n"); + (void) fputc('\n', fp); } static int @@ -313,7 +309,7 @@ write_inuse_diffs_one(FILE *fp, differ_info_t *di, uint64_t dobj) print_link_change(fp, di, change, change > 0 ? fobjname : tobjname, &tsb); } else if (strcmp(fobjname, tobjname) == 0) { - print_file(fp, di, ZDIFF_MODIFIED, fobjname, &tsb); + print_file(fp, di, *ZDIFF_MODIFIED, fobjname, &tsb); } else { print_rename(fp, di, fobjname, tobjname, &tsb); }