summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-12-01 18:24:10 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-12-01 18:24:10 +0000
commit5be8dc2143c7b3b21a9b8fb56797dd855ee87560 (patch)
treec05a66556a187b90c0bd8cab1429f04cd3587967 /lib
parent134ea28aaf76a3497361c99e115ff666b0c000b8 (diff)
downloade2fsprogs-5be8dc2143c7b3b21a9b8fb56797dd855ee87560.tar.gz
Many files:
dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more paranoid about validating the directory counts from the block group information. all files: Don't include stdlib.h anymore; include it in ext2_fs.h, since that file requires stdlib.h ChangeLog, Makefile.in, dirinfo.c: dirinfo.c (e2fsck_add_dir_info): Use ext2fs_get_num_dirs instead of e2fsck_get_num_dirs, which has been removed. Makefile.in (PROGS): Remove @EXTRA_PROGS@, since we don't want to compile and install flushb. ChangeLog, configure.in: Remove @EXTRA_PROGS@, since we aren't using it in 2fsck/Makefile.in anymore ChangeLog, Makefile.in: Install debugfs in /sbin, instead of /usr/sbin. libext2fs.texinfo: Update version string to be 1.12 Makefile.in: Fix bug in find script which made the exclusion list, where a '-' was missing from an -name option.
Diffstat (limited to 'lib')
-rw-r--r--lib/ext2fs/ChangeLog9
-rw-r--r--lib/ext2fs/alloc.c1
-rw-r--r--lib/ext2fs/alloc_tables.c1
-rw-r--r--lib/ext2fs/badblocks.c1
-rw-r--r--lib/ext2fs/bb_compat.c1
-rw-r--r--lib/ext2fs/bb_inode.c1
-rw-r--r--lib/ext2fs/bitmaps.c1
-rw-r--r--lib/ext2fs/block.c1
-rw-r--r--lib/ext2fs/bmap.c1
-rw-r--r--lib/ext2fs/bmove.c1
-rw-r--r--lib/ext2fs/brel_ma.c1
-rw-r--r--lib/ext2fs/check_desc.c1
-rw-r--r--lib/ext2fs/closefs.c1
-rw-r--r--lib/ext2fs/cmp_bitmaps.c1
-rw-r--r--lib/ext2fs/dblist.c14
-rw-r--r--lib/ext2fs/dblist_dir.c1
-rw-r--r--lib/ext2fs/dir_iterate.c1
-rw-r--r--lib/ext2fs/dirblock.c1
-rw-r--r--lib/ext2fs/dosio.c1
-rw-r--r--lib/ext2fs/dupfs.c1
-rw-r--r--lib/ext2fs/expanddir.c1
-rw-r--r--lib/ext2fs/ext2fs.h1
-rw-r--r--lib/ext2fs/fileio.c1
-rw-r--r--lib/ext2fs/freefs.c1
-rw-r--r--lib/ext2fs/get_pathname.c1
-rw-r--r--lib/ext2fs/getsize.c3
-rw-r--r--lib/ext2fs/icount.c1
-rw-r--r--lib/ext2fs/initialize.c1
-rw-r--r--lib/ext2fs/inline.c1
-rw-r--r--lib/ext2fs/inode.c1
-rw-r--r--lib/ext2fs/irel_ma.c1
-rw-r--r--lib/ext2fs/ismounted.c3
-rw-r--r--lib/ext2fs/link.c1
-rw-r--r--lib/ext2fs/llseek.c1
-rw-r--r--lib/ext2fs/lookup.c1
-rw-r--r--lib/ext2fs/mkdir.c1
-rw-r--r--lib/ext2fs/namei.c1
-rw-r--r--lib/ext2fs/newdir.c1
-rw-r--r--lib/ext2fs/openfs.c3
-rw-r--r--lib/ext2fs/read_bb.c1
-rw-r--r--lib/ext2fs/read_bb_file.c1
-rw-r--r--lib/ext2fs/rs_bitmap.c1
-rw-r--r--lib/ext2fs/rw_bitmaps.c1
-rw-r--r--lib/ext2fs/swapfs.c1
-rw-r--r--lib/ext2fs/test_io.c1
-rw-r--r--lib/ext2fs/tst_badblocks.c1
-rw-r--r--lib/ext2fs/tst_getsize.c1
-rw-r--r--lib/ext2fs/tst_iscan.c1
-rw-r--r--lib/ext2fs/unix_io.c5
-rw-r--r--lib/ext2fs/unlink.c1
-rw-r--r--lib/ext2fs/valid_blk.c1
-rw-r--r--lib/ext2fs/version.c1
52 files changed, 22 insertions, 61 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index e54ef4e5..bbe24785 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,12 @@
+Fri Nov 28 09:26:31 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more
+ paranoid about validating the directory counts from the
+ block group information.
+
+ * all files: Don't include stdlib.h anymore; include it in
+ ext2_fs.h, since that file requires stdlib.h
+
Thu Nov 20 16:07:38 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* expanddir.c (ext2fs_expand_dir): Check to make sure the block
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 123860c9..6e7b5537 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <time.h>
#include <string.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 769aec90..8c42cd7b 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -15,7 +15,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/badblocks.c b/lib/ext2fs/badblocks.c
index ab1404dd..fba2d997 100644
--- a/lib/ext2fs/badblocks.c
+++ b/lib/ext2fs/badblocks.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/bb_compat.c b/lib/ext2fs/bb_compat.c
index 4b52675c..ec4911e4 100644
--- a/lib/ext2fs/bb_compat.c
+++ b/lib/ext2fs/bb_compat.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index abad6753..eab5a78f 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -18,7 +18,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
index 0887e575..e50560c5 100644
--- a/lib/ext2fs/bitmaps.c
+++ b/lib/ext2fs/bitmaps.c
@@ -15,7 +15,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 29460036..c594d8d3 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/bmap.c b/lib/ext2fs/bmap.c
index 43f9f310..ec421cee 100644
--- a/lib/ext2fs/bmap.c
+++ b/lib/ext2fs/bmap.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c
index 69722579..0a5a80c0 100644
--- a/lib/ext2fs/bmove.c
+++ b/lib/ext2fs/bmove.c
@@ -11,7 +11,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
diff --git a/lib/ext2fs/brel_ma.c b/lib/ext2fs/brel_ma.c
index 3f82a29d..c515e4a4 100644
--- a/lib/ext2fs/brel_ma.c
+++ b/lib/ext2fs/brel_ma.c
@@ -14,7 +14,6 @@
#include <fcntl.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c
index 602753d2..0764ae4d 100644
--- a/lib/ext2fs/check_desc.c
+++ b/lib/ext2fs/check_desc.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 4a880e8a..b39b15d2 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <time.h>
#include <string.h>
diff --git a/lib/ext2fs/cmp_bitmaps.c b/lib/ext2fs/cmp_bitmaps.c
index 9cec4d77..422606b4 100644
--- a/lib/ext2fs/cmp_bitmaps.c
+++ b/lib/ext2fs/cmp_bitmaps.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c
index cdf1bef2..4c15922c 100644
--- a/lib/ext2fs/dblist.c
+++ b/lib/ext2fs/dblist.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <time.h>
@@ -32,13 +31,20 @@ static int dir_block_cmp(const void *a, const void *b);
errcode_t ext2fs_get_num_dirs(ext2_filsys fs, ino_t *ret_num_dirs)
{
int i;
- ino_t num_dirs;
+ ino_t num_dirs, max_dirs;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
num_dirs = 0;
- for (i = 0; i < fs->group_desc_count; i++)
- num_dirs += fs->group_desc[i].bg_used_dirs_count;
+ max_dirs = 8 * fs->blocksize;
+ for (i = 0; i < fs->group_desc_count; i++) {
+ if (fs->group_desc[i].bg_used_dirs_count > max_dirs)
+ num_dirs += max_dirs;
+ else
+ num_dirs += fs->group_desc[i].bg_used_dirs_count;
+ }
+ if (num_dirs > fs->super->s_inodes_count)
+ num_dirs = fs->super->s_inodes_count;
*ret_num_dirs = num_dirs;
diff --git a/lib/ext2fs/dblist_dir.c b/lib/ext2fs/dblist_dir.c
index 2c8b8a1d..1594cdc5 100644
--- a/lib/ext2fs/dblist_dir.c
+++ b/lib/ext2fs/dblist_dir.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/lib/ext2fs/dir_iterate.c b/lib/ext2fs/dir_iterate.c
index 0784ef20..725cd473 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
#endif
diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c
index 0bb7cc55..85a38de3 100644
--- a/lib/ext2fs/dirblock.c
+++ b/lib/ext2fs/dirblock.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/lib/ext2fs/dosio.c b/lib/ext2fs/dosio.c
index b1d79711..c6baddb8 100644
--- a/lib/ext2fs/dosio.c
+++ b/lib/ext2fs/dosio.c
@@ -11,7 +11,6 @@
#include <stdio.h>
#include <bios.h>
#include <string.h>
-#include <stdlib.h>
#include <ctype.h>
#include <io.h>
#ifdef HAVE_ERRNO_H
diff --git a/lib/ext2fs/dupfs.c b/lib/ext2fs/dupfs.c
index f358eca2..667726dc 100644
--- a/lib/ext2fs/dupfs.c
+++ b/lib/ext2fs/dupfs.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <time.h>
#include <string.h>
diff --git a/lib/ext2fs/expanddir.c b/lib/ext2fs/expanddir.c
index fc14ad4e..07973a46 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index f9eb34e4..f19fdbe5 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -36,6 +36,7 @@
#include <sys/types.h>
#endif
+#include <stdlib.h>
#include <linux/types.h>
typedef __u32 blk_t;
diff --git a/lib/ext2fs/fileio.c b/lib/ext2fs/fileio.c
index 4f34fde6..f0e55e14 100644
--- a/lib/ext2fs/fileio.c
+++ b/lib/ext2fs/fileio.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/freefs.c b/lib/ext2fs/freefs.c
index 71d1ef79..52a769e4 100644
--- a/lib/ext2fs/freefs.c
+++ b/lib/ext2fs/freefs.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/get_pathname.c b/lib/ext2fs/get_pathname.c
index baa9af88..9ace71a7 100644
--- a/lib/ext2fs/get_pathname.c
+++ b/lib/ext2fs/get_pathname.c
@@ -23,7 +23,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/getsize.c b/lib/ext2fs/getsize.c
index c90708e7..a8cd59cd 100644
--- a/lib/ext2fs/getsize.c
+++ b/lib/ext2fs/getsize.c
@@ -13,9 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#include <fcntl.h>
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
diff --git a/lib/ext2fs/icount.c b/lib/ext2fs/icount.c
index 56e50139..72ef44d7 100644
--- a/lib/ext2fs/icount.c
+++ b/lib/ext2fs/icount.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <stdio.h>
diff --git a/lib/ext2fs/initialize.c b/lib/ext2fs/initialize.c
index 1fcff190..4ab44de4 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -15,7 +15,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/inline.c b/lib/ext2fs/inline.c
index 97c3d069..fc096689 100644
--- a/lib/ext2fs/inline.c
+++ b/lib/ext2fs/inline.c
@@ -17,7 +17,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 8695ff06..d72e00cc 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#if HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
diff --git a/lib/ext2fs/irel_ma.c b/lib/ext2fs/irel_ma.c
index 6ff816b4..2ca6fb5c 100644
--- a/lib/ext2fs/irel_ma.c
+++ b/lib/ext2fs/irel_ma.c
@@ -11,7 +11,6 @@
#include <fcntl.h>
#include <stdio.h>
-#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
diff --git a/lib/ext2fs/ismounted.c b/lib/ext2fs/ismounted.c
index 621fd188..0761ec8e 100644
--- a/lib/ext2fs/ismounted.c
+++ b/lib/ext2fs/ismounted.c
@@ -13,9 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#include <fcntl.h>
#ifdef HAVE_LINUX_FS_H
#include <linux/fs.h>
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c
index a8e51506..978a6f3b 100644
--- a/lib/ext2fs/link.c
+++ b/lib/ext2fs/link.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/llseek.c b/lib/ext2fs/llseek.c
index 9829444c..5fd35596 100644
--- a/lib/ext2fs/llseek.c
+++ b/lib/ext2fs/llseek.c
@@ -16,7 +16,6 @@
#if HAVE_ERRNO_H
#include <errno.h>
#endif
-#include <stdlib.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c
index 364f2a2a..833ba4e5 100644
--- a/lib/ext2fs/lookup.c
+++ b/lib/ext2fs/lookup.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c
index 9348cb7c..f517ba37 100644
--- a/lib/ext2fs/mkdir.c
+++ b/lib/ext2fs/mkdir.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/namei.c b/lib/ext2fs/namei.c
index 576a99fb..f44c7df3 100644
--- a/lib/ext2fs/namei.c
+++ b/lib/ext2fs/namei.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
/* #define NAMEI_DEBUG */
diff --git a/lib/ext2fs/newdir.c b/lib/ext2fs/newdir.c
index 8e90a7a5..ed29a6f5 100644
--- a/lib/ext2fs/newdir.c
+++ b/lib/ext2fs/newdir.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index 26c7f7b2..7c0e2eb8 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -14,9 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if HAVE_STDLIB_H
-#include <stdlib.h>
-#endif
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c
index 99c653d2..4e9a5ddb 100644
--- a/lib/ext2fs/read_bb.c
+++ b/lib/ext2fs/read_bb.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/read_bb_file.c b/lib/ext2fs/read_bb_file.c
index 7534c640..6cdb1405 100644
--- a/lib/ext2fs/read_bb_file.c
+++ b/lib/ext2fs/read_bb_file.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/rs_bitmap.c b/lib/ext2fs/rs_bitmap.c
index aee47259..73df276e 100644
--- a/lib/ext2fs/rs_bitmap.c
+++ b/lib/ext2fs/rs_bitmap.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#ifdef HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index 7909fff7..93b775ce 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#ifdef HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index b4330d63..1a780f64 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <time.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index e2fe1ccc..1ac06634 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
diff --git a/lib/ext2fs/tst_badblocks.c b/lib/ext2fs/tst_badblocks.c
index 2063420e..0324dd7b 100644
--- a/lib/ext2fs/tst_badblocks.c
+++ b/lib/ext2fs/tst_badblocks.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <sys/stat.h>
diff --git a/lib/ext2fs/tst_getsize.c b/lib/ext2fs/tst_getsize.c
index 232fc2d1..49e8b6fd 100644
--- a/lib/ext2fs/tst_getsize.c
+++ b/lib/ext2fs/tst_getsize.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <sys/stat.h>
diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c
index 2febe62e..9f5874b7 100644
--- a/lib/ext2fs/tst_iscan.c
+++ b/lib/ext2fs/tst_iscan.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#include <sys/stat.h>
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 53bedb9a..2c1d3c90 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -16,7 +16,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
#if HAVE_SYS_STAT_H
@@ -195,7 +194,7 @@ static errcode_t unix_read_blk(io_channel channel, unsigned long block,
size = (count < 0) ? -count : count * channel->block_size;
location = (ext2_loff_t) block * channel->block_size;
if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
- retval = errno ? errno : EXT2_IO_LLSEEK_FAILED;
+ retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
goto error_out;
}
actual = read(data->dev, buf, size);
@@ -244,7 +243,7 @@ static errcode_t unix_write_blk(io_channel channel, unsigned long block,
location = (ext2_loff_t) block * channel->block_size;
if (ext2fs_llseek(data->dev, location, SEEK_SET) != location) {
- retval = errno ? errno : EXT2_IO_LLSEEK_FAILED;
+ retval = errno ? errno : EXT2_ET_LLSEEK_FAILED;
goto error_out;
}
diff --git a/lib/ext2fs/unlink.c b/lib/ext2fs/unlink.c
index d880c471..bdaa7c18 100644
--- a/lib/ext2fs/unlink.c
+++ b/lib/ext2fs/unlink.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/valid_blk.c b/lib/ext2fs/valid_blk.c
index c7ca2b35..6d6734ee 100644
--- a/lib/ext2fs/valid_blk.c
+++ b/lib/ext2fs/valid_blk.c
@@ -14,7 +14,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/lib/ext2fs/version.c b/lib/ext2fs/version.c
index 4e72f5c2..e3c49cd4 100644
--- a/lib/ext2fs/version.c
+++ b/lib/ext2fs/version.c
@@ -13,7 +13,6 @@
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
-#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>