From: Theodore Ts'o Date: Thu, 11 Sep 2014 16:24:07 +0000 (-0400) Subject: e2fsck: notice when the realloc of dir_info fails X-Git-Tag: v1.42.13~39 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=e9a5c6e3607d17641543aa5e801af22563fb1410;p=tools%2Fe2fsprogs.git e2fsck: notice when the realloc of dir_info fails If the reallocation of dir_info fails, we will eventually cause e2fsck to fail with an internal error. So if the realloc fails, print a message and bail out with a fatal error early when at the time of the reallocation failure. Signed-off-by: Theodore Ts'o --- diff --git a/e2fsck/dirinfo.c b/e2fsck/dirinfo.c index dbaf471..4a9019b 100644 --- a/e2fsck/dirinfo.c +++ b/e2fsck/dirinfo.c @@ -140,6 +140,10 @@ void e2fsck_add_dir_info(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent) sizeof(struct dir_info), &ctx->dir_info->array); if (retval) { + fprintf(stderr, "Couldn't reallocate dir_info " + "structure to %d entries\n", + ctx->dir_info->size); + fatal_error(ctx, 0); ctx->dir_info->size -= 10; return; } diff --git a/e2fsck/dx_dirinfo.c b/e2fsck/dx_dirinfo.c index 7838a40..be53fff 100644 --- a/e2fsck/dx_dirinfo.c +++ b/e2fsck/dx_dirinfo.c @@ -40,6 +40,10 @@ void e2fsck_add_dx_dir(e2fsck_t ctx, ext2_ino_t ino, int num_blocks) sizeof(struct dx_dir_info), &ctx->dx_dir_info); if (retval) { + fprintf(stderr, "Couldn't reallocate dx_dir_info " + "structure to %d entries\n", + ctx->dx_dir_info_size); + fatal_error(ctx, 0); ctx->dx_dir_info_size -= 10; return; }