summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Sumrall <ksumrall@android.com>2011-03-31 16:11:52 -0700
committerKen Sumrall <ksumrall@android.com>2011-03-31 16:11:52 -0700
commit7c81ec40f5f466b23c2ebacabe1e4e9ac6932bd5 (patch)
tree894698baf00419e21c34512f90ff4cfa1c89fbd4
parentc12588ca8b1f4f38f55745a30656a5576aa4b6f9 (diff)
downloadextras-7c81ec40f5f466b23c2ebacabe1e4e9ac6932bd5.tar.gz
Properly compute the size of a directory
When computing the size of a directory that is being created, make sure to include the size of the null entry at the end of the list of entries in that directory. Change-Id: I7deb05a170911cd0cc8517600c9747f64915606f
-rw-r--r--ext4_utils/contents.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext4_utils/contents.c b/ext4_utils/contents.c
index ba7e05f3..c7607ab1 100644
--- a/ext4_utils/contents.c
+++ b/ext4_utils/contents.c
@@ -39,6 +39,11 @@ static u32 dentry_size(u32 entries, struct dentry *dentries)
len += dentry_len;
}
+ /* include size of the dentry used to pad until the end of the block */
+ if (len % info.block_size + 8 > info.block_size)
+ len += info.block_size - (len % info.block_size);
+ len += 8;
+
return len;
}