diff --git a/e2fsck/e2fsck.c b/e2fsck/e2fsck.c index e2434da8..9afd906e 100644 --- a/e2fsck/e2fsck.c +++ b/e2fsck/e2fsck.c @@ -169,6 +169,12 @@ void e2fsck_free_context(e2fsck_t ctx) if (ctx->profile) profile_release(ctx->profile); + + if (ctx->filesystem_name) + ext2fs_free_mem(&ctx->filesystem_name); + + if (ctx->device_name) + ext2fs_free_mem(&ctx->device_name); ext2fs_free_mem(&ctx); } diff --git a/e2fsck/unix.c b/e2fsck/unix.c index e8432447..3eb30647 100644 --- a/e2fsck/unix.c +++ b/e2fsck/unix.c @@ -444,14 +444,15 @@ int e2fsck_simple_progress(e2fsck_t ctx, const char *label, float percent, static int e2fsck_update_progress(e2fsck_t ctx, int pass, unsigned long cur, unsigned long max) { - char buf[80]; + char buf[1024]; float percent; if (pass == 0) return 0; if (ctx->progress_fd) { - sprintf(buf, "%d %lu %lu\n", pass, cur, max); + snprintf(buf, sizeof(buf), "%d %lu %lu %s\n", + pass, cur, max, ctx->device_name); write(ctx->progress_fd, buf, strlen(buf)); } else { percent = calc_percent(&e2fsck_tbl, pass, cur, max); @@ -774,6 +775,7 @@ static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) argv[optind]); fatal_error(ctx, 0); } + ctx->filesystem_name = string_copy(ctx, ctx->filesystem_name, 0); if (extended_opts) parse_extended_opts(ctx, extended_opts); @@ -888,6 +890,7 @@ int main (int argc, char *argv[]) int journal_size; int sysval, sys_page_size = 4096; __u32 features[3]; + char *cp; clear_problem_context(&pctx); #ifdef MTRACE @@ -1109,7 +1112,10 @@ restart: sizeof(sb->s_volume_name)); } if (ctx->device_name == 0) - ctx->device_name = ctx->filesystem_name; + ctx->device_name = string_copy(ctx, ctx->filesystem_name, 0); + for (cp = ctx->device_name; *cp; cp++) + if (isspace(*cp) || *cp == ':') + *cp = '_'; /* * Make sure the ext3 superblock fields are consistent.