diff options
author | Erik Andersen <andersen@codepoet.org> | 2000-03-21 22:32:57 +0000 |
---|---|---|
committer | Erik Andersen <andersen@codepoet.org> | 2000-03-21 22:32:57 +0000 |
commit | 0d068a20676144e9fd6796cc77764c420d785394 (patch) | |
tree | af12b114d51e9ae7a8753baf09feb9ab8d654f26 /mkfs_minix.c | |
parent | c053e41fa0524d828bf90f47e5e3637b8facaadc (diff) | |
download | busybox-w32-0d068a20676144e9fd6796cc77764c420d785394.tar.gz busybox-w32-0d068a20676144e9fd6796cc77764c420d785394.tar.bz2 busybox-w32-0d068a20676144e9fd6796cc77764c420d785394.zip |
* all mallocs now use xmalloc (and so are OOM error safe), and
the common error handling saves a few bytes. Thanks to
Bob Tinsley <bob@earthrise.demon.co.uk> for the patch.
-Erik
Diffstat (limited to 'mkfs_minix.c')
-rw-r--r-- | mkfs_minix.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/mkfs_minix.c b/mkfs_minix.c index 4435cb64a..1ee3d4cfa 100644 --- a/mkfs_minix.c +++ b/mkfs_minix.c | |||
@@ -530,19 +530,15 @@ static void setup_tables(void) | |||
530 | die("unable to allocate buffers for maps"); | 530 | die("unable to allocate buffers for maps"); |
531 | } | 531 | } |
532 | FIRSTZONE = NORM_FIRSTZONE; | 532 | FIRSTZONE = NORM_FIRSTZONE; |
533 | inode_map = malloc(IMAPS * BLOCK_SIZE); | 533 | inode_map = xmalloc(IMAPS * BLOCK_SIZE); |
534 | zone_map = malloc(ZMAPS * BLOCK_SIZE); | 534 | zone_map = xmalloc(ZMAPS * BLOCK_SIZE); |
535 | if (!inode_map || !zone_map) | ||
536 | die("unable to allocate buffers for maps"); | ||
537 | memset(inode_map, 0xff, IMAPS * BLOCK_SIZE); | 535 | memset(inode_map, 0xff, IMAPS * BLOCK_SIZE); |
538 | memset(zone_map, 0xff, ZMAPS * BLOCK_SIZE); | 536 | memset(zone_map, 0xff, ZMAPS * BLOCK_SIZE); |
539 | for (i = FIRSTZONE; i < ZONES; i++) | 537 | for (i = FIRSTZONE; i < ZONES; i++) |
540 | unmark_zone(i); | 538 | unmark_zone(i); |
541 | for (i = MINIX_ROOT_INO; i <= INODES; i++) | 539 | for (i = MINIX_ROOT_INO; i <= INODES; i++) |
542 | unmark_inode(i); | 540 | unmark_inode(i); |
543 | inode_buffer = malloc(INODE_BUFFER_SIZE); | 541 | inode_buffer = xmalloc(INODE_BUFFER_SIZE); |
544 | if (!inode_buffer) | ||
545 | die("unable to allocate buffer for inodes"); | ||
546 | memset(inode_buffer, 0, INODE_BUFFER_SIZE); | 542 | memset(inode_buffer, 0, INODE_BUFFER_SIZE); |
547 | printf("%ld inodes\n", INODES); | 543 | printf("%ld inodes\n", INODES); |
548 | printf("%ld blocks\n", ZONES); | 544 | printf("%ld blocks\n", ZONES); |