diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index 350c957..b90ccc5 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -206,28 +206,26 @@
 #define BITS_PER_BLOCK (BLOCK_SIZE<<3)
 
 static char *program_version = "1.2 - 11/11/96";
-static char *device_name = NULL;
+static char *device_name;
 static int IN;
-static int repair = 0, automatic = 0, verbose = 0, list = 0, show =
-	0, warn_mode = 0, force = 0;
-static int directory = 0, regular = 0, blockdev = 0, chardev = 0, links =
-	0, symlinks = 0, total = 0;
+static int repair, automatic, verbose, list, show, warn_mode, force;
+static int directory, regular, blockdev, chardev, links, symlinks, total;
 
-static int changed = 0;			/* flags if the filesystem has been changed */
-static int errors_uncorrected = 0;	/* flag if some error was not corrected */
+static int changed;			/* flags if the filesystem has been changed */
+static int errors_uncorrected;	/* flag if some error was not corrected */
 static int dirsize = 16;
 static int namelen = 14;
-static int version2 = 0;
+static int version2;
 static struct termios termios;
-static int termios_set = 0;
+static int termios_set;
 
 /* File-name data */
 enum { MAX_DEPTH = 32 };
-static int name_depth = 0;
+static int name_depth;
 // static char name_list[MAX_DEPTH][BUFSIZ + 1];
-static char **name_list = NULL;
+static char **name_list;
 
-static char *inode_buffer = NULL;
+static char *inode_buffer;
 
 #define Inode (((struct minix_inode *) inode_buffer)-1)
 #define Inode2 (((struct minix2_inode *) inode_buffer)-1)
@@ -251,8 +249,8 @@
 static char *inode_map;
 static char *zone_map;
 
-static unsigned char *inode_count = NULL;
-static unsigned char *zone_count = NULL;
+static unsigned char *inode_count;
+static unsigned char *zone_count;
 
 static void recursive_check(unsigned int ino);
 #ifdef CONFIG_FEATURE_MINIX2
@@ -375,12 +373,11 @@
 		close(fd);
 
 	printf("%s is mounted.	 ", device_name);
+	cont = 0;
 	if (isatty(0) && isatty(1))
 		cont = ask("Do you really want to continue", 0);
-	else
-		cont = 0;
 	if (!cont) {
-		printf("check aborted.\n");
+		printf("Check aborted\n");
 		exit(0);
 	}
 	return;
@@ -392,7 +389,7 @@
  * if an error was corrected, and returns the zone (0 for no zone
  * or a bad zone-number).
  */
-static int check_zone_nr(unsigned short *nr, int *corrected)
+static int check_zone_nr2(uint32_t *nr, int *corrected)
 {
 	if (!*nr)
 		return 0;
@@ -411,26 +408,13 @@
 	return 0;
 }
 
-#ifdef CONFIG_FEATURE_MINIX2
-static int check_zone_nr2(unsigned int *nr, int *corrected)
+static int check_zone_nr(uint16_t *nr, int *corrected)
 {
-	if (!*nr)
-		return 0;
-	if (*nr < FIRSTZONE)
-		printf("Zone nr < FIRSTZONE in file `");
-	else if (*nr >= ZONES)
-		printf("Zone nr >= ZONES in file `");
-	else
-		return *nr;
-	print_current_name();
-	printf("'.");
-	if (ask("Remove block", 1)) {
-		*nr = 0;
-		*corrected = 1;
-	}
-	return 0;
+	uint32_t nr32 = *nr;
+	int r = check_zone_nr2(&nr32, corrected);
+	*nr = (uint16_t)nr32;
+	return r;
 }
-#endif
 
 /*
  * read-block reads block nr into the buffer at addr.
@@ -445,14 +429,14 @@
 		printf("Read error: unable to seek to block in file '");
 		print_current_name();
 		printf("'\n");
-		memset(addr, 0, BLOCK_SIZE);
 		errors_uncorrected = 1;
+		memset(addr, 0, BLOCK_SIZE);
 	} else if (BLOCK_SIZE != read(IN, addr, BLOCK_SIZE)) {
 		printf("Read error: bad block in file '");
 		print_current_name();
 		printf("'\n");
-		memset(addr, 0, BLOCK_SIZE);
 		errors_uncorrected = 1;
+		memset(addr, 0, BLOCK_SIZE);
 	}
 }
 
@@ -480,14 +464,14 @@
 }
 
 /*
- * map-block calculates the absolute block nr of a block in a file.
+ * map_block calculates the absolute block nr of a block in a file.
  * It sets 'changed' if the inode has needed changing, and re-writes
  * any indirect blocks with errors.
  */
 static int map_block(struct minix_inode *inode, unsigned int blknr)
 {
-	unsigned short ind[BLOCK_SIZE >> 1];
-	unsigned short dind[BLOCK_SIZE >> 1];
+	uint16_t ind[BLOCK_SIZE >> 1];
+	uint16_t dind[BLOCK_SIZE >> 1];
 	int blk_chg, block, result;
 
 	if (blknr < 7)
@@ -521,9 +505,9 @@
 #ifdef CONFIG_FEATURE_MINIX2
 static int map_block2(struct minix2_inode *inode, unsigned int blknr)
 {
-	unsigned int ind[BLOCK_SIZE >> 2];
-	unsigned int dind[BLOCK_SIZE >> 2];
-	unsigned int tind[BLOCK_SIZE >> 2];
+	uint32_t ind[BLOCK_SIZE >> 2];
+	uint32_t dind[BLOCK_SIZE >> 2];
+	uint32_t tind[BLOCK_SIZE >> 2];
 	int blk_chg, block, result;
 
 	if (blknr < 7)
@@ -594,8 +578,6 @@
 		die("seek failed in write_super_block");
 	if (BLOCK_SIZE != write(IN, super_block_buffer, BLOCK_SIZE))
 		die("unable to write super-block");
-
-	return;
 }
 
 static void write_tables(void)
@@ -639,18 +621,15 @@
 		die("seek failed");
 	if (BLOCK_SIZE != read(IN, super_block_buffer, BLOCK_SIZE))
 		die("unable to read super block");
+	namelen = 14;
+	dirsize = 16;
+	version2 = 0;
 	if (MAGIC == MINIX_SUPER_MAGIC) {
-		namelen = 14;
-		dirsize = 16;
-		version2 = 0;
 	} else if (MAGIC == MINIX_SUPER_MAGIC2) {
 		namelen = 30;
 		dirsize = 32;
-		version2 = 0;
 #ifdef CONFIG_FEATURE_MINIX2
 	} else if (MAGIC == MINIX2_SUPER_MAGIC) {
-		namelen = 14;
-		dirsize = 16;
 		version2 = 1;
 	} else if (MAGIC == MINIX2_SUPER_MAGIC2) {
 		namelen = 30;
@@ -688,13 +667,20 @@
 	}
 	get_dirsize();
 	if (show) {
-		printf("%ld inodes\n", INODES);
-		printf("%ld blocks\n", ZONES);
-		printf("Firstdatazone=%ld (%ld)\n", FIRSTZONE, NORM_FIRSTZONE);
-		printf("Zonesize=%d\n", BLOCK_SIZE << ZONESIZE);
-		printf("Maxsize=%ld\n", MAXSIZE);
-		printf("Filesystem state=%d\n", Super.s_state);
-		printf("namelen=%d\n\n", namelen);
+		printf("%ld inodes\n"
+			"%ld blocks\n"
+			"Firstdatazone=%ld (%ld)\n"
+			"Zonesize=%d\n"
+			"Maxsize=%ld\n"
+			"Filesystem state=%d\n"
+			"namelen=%d\n\n",
+			INODES,
+			ZONES,
+			FIRSTZONE, NORM_FIRSTZONE,
+			BLOCK_SIZE << ZONESIZE,
+			MAXSIZE,
+			Super.s_state,
+			namelen);
 	}
 }
 
@@ -738,7 +724,7 @@
 	} else
 		links++;
 	if (!++inode_count[nr]) {
-		printf("Warning: inode count too big.\n");
+		printf("Warning: inode count too big\n");
 		inode_count[nr]--;
 		errors_uncorrected = 1;
 	}
@@ -785,7 +771,7 @@
 	} else
 		links++;
 	if (!++inode_count[nr]) {
-		printf("Warning: inode count too big.\n");
+		printf("Warning: inode count too big\n");
 		inode_count[nr]--;
 		errors_uncorrected = 1;
 	}
@@ -811,7 +797,7 @@
 }
 #endif
 
-static int add_zone(unsigned short *znr, int *corrected)
+static int add_zone(uint16_t *znr, int *corrected)
 {
 	int result;
 	int block;
@@ -828,10 +814,9 @@
 			*znr = 0;
 			block = 0;
 			*corrected = 1;
+			return 0;
 		}
 	}
-	if (!block)
-		return 0;
 	if (!zone_in_use(block)) {
 		printf("Block %d in file `", block);
 		print_current_name();
@@ -845,7 +830,7 @@
 }
 
 #ifdef CONFIG_FEATURE_MINIX2
-static int add_zone2(unsigned int *znr, int *corrected)
+static int add_zone2(uint32_t *znr, int *corrected)
 {
 	int result;
 	int block;
@@ -862,10 +847,9 @@
 			*znr = 0;
 			block = 0;
 			*corrected = 1;
+			return 0;
 		}
 	}
-	if (!block)
-		return 0;
 	if (!zone_in_use(block)) {
 		printf("Block %d in file `", block);
 		print_current_name();
@@ -879,7 +863,7 @@
 }
 #endif
 
-static void add_zone_ind(unsigned short *znr, int *corrected)
+static void add_zone_ind(uint16_t *znr, int *corrected)
 {
 	static char blk[BLOCK_SIZE];
 	int i, chg_blk = 0;
@@ -890,13 +874,13 @@
 		return;
 	read_block(block, blk);
 	for (i = 0; i < (BLOCK_SIZE >> 1); i++)
-		add_zone(i + (unsigned short *) blk, &chg_blk);
+		add_zone(i + (uint16_t *) blk, &chg_blk);
 	if (chg_blk)
 		write_block(block, blk);
 }
 
 #ifdef CONFIG_FEATURE_MINIX2
-static void add_zone_ind2(unsigned int *znr, int *corrected)
+static void add_zone_ind2(uint32_t *znr, int *corrected)
 {
 	static char blk[BLOCK_SIZE];
 	int i, chg_blk = 0;
@@ -907,13 +891,13 @@
 		return;
 	read_block(block, blk);
 	for (i = 0; i < BLOCK_SIZE >> 2; i++)
-		add_zone2(i + (unsigned int *) blk, &chg_blk);
+		add_zone2(i + (uint32_t *) blk, &chg_blk);
 	if (chg_blk)
 		write_block(block, blk);
 }
 #endif
 
-static void add_zone_dind(unsigned short *znr, int *corrected)
+static void add_zone_dind(uint16_t *znr, int *corrected)
 {
 	static char blk[BLOCK_SIZE];
 	int i, blk_chg = 0;
@@ -924,13 +908,13 @@
 		return;
 	read_block(block, blk);
 	for (i = 0; i < (BLOCK_SIZE >> 1); i++)
-		add_zone_ind(i + (unsigned short *) blk, &blk_chg);
+		add_zone_ind(i + (uint16_t *) blk, &blk_chg);
 	if (blk_chg)
 		write_block(block, blk);
 }
 
 #ifdef CONFIG_FEATURE_MINIX2
-static void add_zone_dind2(unsigned int *znr, int *corrected)
+static void add_zone_dind2(uint32_t *znr, int *corrected)
 {
 	static char blk[BLOCK_SIZE];
 	int i, blk_chg = 0;
@@ -941,12 +925,12 @@
 		return;
 	read_block(block, blk);
 	for (i = 0; i < BLOCK_SIZE >> 2; i++)
-		add_zone_ind2(i + (unsigned int *) blk, &blk_chg);
+		add_zone_ind2(i + (uint32_t *) blk, &blk_chg);
 	if (blk_chg)
 		write_block(block, blk);
 }
 
-static void add_zone_tind2(unsigned int *znr, int *corrected)
+static void add_zone_tind2(uint32_t *znr, int *corrected)
 {
 	static char blk[BLOCK_SIZE];
 	int i, blk_chg = 0;
@@ -957,7 +941,7 @@
 		return;
 	read_block(block, blk);
 	for (i = 0; i < BLOCK_SIZE >> 2; i++)
-		add_zone_dind2(i + (unsigned int *) blk, &blk_chg);
+		add_zone_dind2(i + (uint32_t *) blk, &blk_chg);
 	if (blk_chg)
 		write_block(block, blk);
 }
@@ -1012,13 +996,13 @@
 	block = map_block(dir, offset / BLOCK_SIZE);
 	read_block(block, blk);
 	name = blk + (offset % BLOCK_SIZE) + 2;
-	ino = *(unsigned short *) (name - 2);
+	ino = *(uint16_t *) (name - 2);
 	if (ino > INODES) {
 		print_current_name();
 		printf(" contains a bad inode number for file '");
 		printf("%.*s'.", namelen, name);
 		if (ask(" Remove", 1)) {
-			*(unsigned short *) (name - 2) = 0;
+			*(uint16_t *) (name - 2) = 0;
 			write_block(block, blk);
 		}
 		ino = 0;
@@ -1077,13 +1061,13 @@
 	block = map_block2(dir, offset / BLOCK_SIZE);
 	read_block(block, blk);
 	name = blk + (offset % BLOCK_SIZE) + 2;
-	ino = *(unsigned short *) (name - 2);
+	ino = *(uint16_t *) (name - 2);
 	if (ino > INODES) {
 		print_current_name();
 		printf(" contains a bad inode number for file '");
 		printf("%.*s'.", namelen, name);
 		if (ask(" Remove", 1)) {
-			*(unsigned short *) (name - 2) = 0;
+			*(uint16_t *) (name - 2) = 0;
 			write_block(block, blk);
 		}
 		ino = 0;
@@ -1179,7 +1163,7 @@
 	int i;
 
 	for (i = 1; i <= INODES; i++) {
-		if (!inode_in_use(i) && Inode[i].i_mode && warn_mode) {
+		if (warn_mode && Inode[i].i_mode && !inode_in_use(i)) {
 			printf("Inode %d mode not cleared.", i);
 			if (ask("Clear", 1)) {
 				Inode[i].i_mode = 0;
@@ -1230,7 +1214,7 @@
 	int i;
 
 	for (i = 1; i <= INODES; i++) {
-		if (!inode_in_use(i) && Inode2[i].i_mode && warn_mode) {
+		if (warn_mode && Inode2[i].i_mode && !inode_in_use(i)) {
 			printf("Inode %d mode not cleared.", i);
 			if (ask("Clear", 1)) {
 				Inode2[i].i_mode = 0;
@@ -1305,7 +1289,7 @@
 
 	name_list = xmalloc(sizeof(char *) * MAX_DEPTH);
 	for (i = 0; i < MAX_DEPTH; i++)
-		name_list[i] = xmalloc(sizeof(char) * BUFSIZ + 1);
+		name_list[i] = xmalloc(sizeof(char) * (BUFSIZ + 1));
 }
 
 #ifdef CONFIG_FEATURE_CLEAN_UP
@@ -1327,7 +1311,6 @@
 int fsck_minix_main(int argc, char **argv)
 {
 	struct termios tmp;
-	int count;
 	int retcode = 0;
 
 	alloc_name_list();
@@ -1389,11 +1372,10 @@
 	}
 	IN = open(device_name, repair ? O_RDWR : O_RDONLY);
 	if (IN < 0){
-		fprintf(stderr,"unable to open device '%s'.\n",device_name);
+		fprintf(stderr,"unable to open device '%s'\n",device_name);
 		leave(8);
 	}
-	for (count = 0; count < 3; count++)
-		sync();
+	sync(); /* paranoia? */
 	read_superblock();
 
 	/*
@@ -1406,12 +1388,12 @@
 	if (!(Super.s_state & MINIX_ERROR_FS) &&
 		(Super.s_state & MINIX_VALID_FS) && !force) {
 		if (repair)
-			printf("%s is clean, no check.\n", device_name);
+			printf("%s is clean, no check\n", device_name);
 		return retcode;
 	} else if (force)
-		printf("Forcing filesystem check on %s.\n", device_name);
+		printf("Forcing filesystem check on %s\n", device_name);
 	else if (repair)
-		printf("Filesystem on %s is dirty, needs checking.\n",
+		printf("Filesystem on %s is dirty, needs checking\n",
 			   device_name);
 
 	read_tables();
@@ -1463,8 +1445,7 @@
 		printf("----------------------------\n"
 			   "FILE SYSTEM HAS BEEN CHANGED\n"
 			   "----------------------------\n");
-		for (count = 0; count < 3; count++)
-			sync();
+		sync();
 	} else if (repair)
 		write_super_block();
 
