mke2fs: add proper error checking in write_reserved_inodes

Fixes-Coverity-Bug: 1369034
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 57b5bbf..ce78b7c 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -359,9 +359,15 @@
 		exit(1);
 	}
 
-	for (ino = 1; ino < EXT2_FIRST_INO(fs->super); ino++)
-		ext2fs_write_inode_full(fs, ino, inode,
-					EXT2_INODE_SIZE(fs->super));
+	for (ino = 1; ino < EXT2_FIRST_INO(fs->super); ino++) {
+		retval = ext2fs_write_inode_full(fs, ino, inode,
+						 EXT2_INODE_SIZE(fs->super));
+		if (retval) {
+			com_err("ext2fs_write_inode_full", retval,
+				_("while writing reserved inodes"));
+			exit(1);
+		}
+	}
 
 	ext2fs_free_mem(&inode);
 }