diff options
author | Ruediger Meier | 2014-05-19 15:52:38 +0200 |
---|---|---|
committer | Ruediger Meier | 2014-05-19 23:49:29 +0200 |
commit | ae2f9c71ae08e7a5a7403f97de2026303f57f912 (patch) | |
tree | 58ffa6c919f40e27cf5280f94ad4e336a58d52a5 /disk-utils/mkfs.cramfs.c | |
parent | fsck.cramfs: update man page (--extract and --blocksize) (diff) | |
download | kernel-qcow2-util-linux-ae2f9c71ae08e7a5a7403f97de2026303f57f912.tar.gz kernel-qcow2-util-linux-ae2f9c71ae08e7a5a7403f97de2026303f57f912.tar.xz kernel-qcow2-util-linux-ae2f9c71ae08e7a5a7403f97de2026303f57f912.zip |
mkfs.cramfs: fix crash when -b 0
Now -b 0 gives us the default (page size) like we do it in
fsck.cramfs.
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'disk-utils/mkfs.cramfs.c')
-rw-r--r-- | disk-utils/mkfs.cramfs.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/disk-utils/mkfs.cramfs.c b/disk-utils/mkfs.cramfs.c index ebc8112e2..6f412d888 100644 --- a/disk-utils/mkfs.cramfs.c +++ b/disk-utils/mkfs.cramfs.c @@ -53,7 +53,7 @@ static int verbose = 0; -static unsigned int blksize; /* settable via -b option */ +static unsigned int blksize = 0; /* settable via -b option, default page size */ static long total_blocks = 0, total_nodes = 1; /* pre-count the root node */ static int image_length = 0; static int cramfs_is_big_endian = 0; /* target is big endian */ @@ -715,7 +715,6 @@ int main(int argc, char **argv) int c; cramfs_is_big_endian = HOST_IS_BIG_ENDIAN; /* default is to use host order */ - blksize = getpagesize(); total_blocks = 0; setlocale(LC_ALL, ""); @@ -784,6 +783,9 @@ int main(int argc, char **argv) dirname = argv[optind]; outfile = argv[optind + 1]; + if (blksize == 0) + blksize = getpagesize(); + if (stat(dirname, &st) < 0) err(MKFS_EX_USAGE, _("stat failed %s"), dirname); fd = open(outfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); |