aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2013-01-07 15:45:54 -0600
committerTheodore Ts'o <tytso@mit.edu>2013-01-08 10:41:08 -0500
commitbf50beb9f6b4c4d4c9f8fc7fc81d716a9ee79218 (patch)
tree6d6cdb471cc185e88027e901f0f2c6411173924d
parentf45011df2bea466209a4b2701f2770b24518bbac (diff)
downloade2fsprogs-bf50beb9f6b4c4d4c9f8fc7fc81d716a9ee79218.tar.gz
e2fsprogs-bf50beb9f6b4c4d4c9f8fc7fc81d716a9ee79218.tar.xz
e2fsprogs-bf50beb9f6b4c4d4c9f8fc7fc81d716a9ee79218.zip
e2fsck: show size requested when memory allocation fails
"e2fsck: Can't allocate dx_block info array" is only so helpful - it'd be nice to know how much it tried to allocate. In particular, since I think malloc(0) can return NULL, it'd be nice to know if maybe we passed in an uninitialized (or 0-initialized) size. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-rw-r--r--e2fsck/util.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/e2fsck/util.c b/e2fsck/util.c
index a6b9e864..2b7d2ff8 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -121,7 +121,8 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
#endif
ret = malloc(size);
if (!ret) {
- sprintf(buf, "Can't allocate %s\n", description);
+ sprintf(buf, "Can't allocate %u bytes for %s\n",
+ size, description);
fatal_error(ctx, buf);
}
memset(ret, 0, size);