aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ext2fs/alloc.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ext2fs/alloc.c')
-rw-r--r--lib/ext2fs/alloc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 26c01118..5465e804 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -11,6 +11,9 @@
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
+#if HAVE_ERRNO_H
+#include <errno.h>
+#endif
#include <linux/ext2_fs.h>
@@ -40,9 +43,9 @@ errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode,
dir_group = (dir - 1) / EXT2_INODES_PER_GROUP(fs->super);
start_inode = (dir_group * EXT2_INODES_PER_GROUP(fs->super)) + 1;
+ if (start_inode < EXT2_FIRST_INO)
+ start_inode = EXT2_FIRST_INO;
i = start_inode;
- if (i < EXT2_FIRST_INO)
- i = EXT2_FIRST_INO;
do {
if (!ext2fs_test_inode_bitmap(map, i))