summaryrefslogtreecommitdiff
path: root/lib/ext2fs
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1997-08-10 23:07:40 +0000
committerTheodore Ts'o <tytso@mit.edu>1997-08-10 23:07:40 +0000
commit4cbe8af4b0d0c72fb28bb500c1bd8a46b00fdde3 (patch)
treead7f47af97b5e18f820fdbef20bb576cc6aadb04 /lib/ext2fs
parenta47b66ee09960a8bf00e72b431ec56d68e11a301 (diff)
downloade2fsprogs-4cbe8af4b0d0c72fb28bb500c1bd8a46b00fdde3.tar.gz
Many files:
block.c (ext2fs_block_iterate2): Use retval which is a errcode_t type. bitmaps.c (make_bitmap): Use size_t instead of int where appropriate. bb_inode.c (set_bad_block_proc): Add #pragma argsused for Turbo C. alloc.c (ext2fs_new_inode): Use ino_t instead of int for the group number. get_pathname.c: Use ino_t instead of int where appropriate. ext2fs.h: Make the magic structure element be errcode_t instead of int. alloc.c alloc_tables.c badblocks.c bb_compat.c bb_inode.c bitmaps.c block.c bmove.c brel_ma.c check_desc.c closefs.c cmp_bitmaps.c dblist.c dblist_dir.c dir_iterate.c dirblock.c dupfs.c expanddir.c freefs.c get_pathname.c icount.c initialize.c inline.c inode.c irel_ma.c link.c llseek.c lookup.c mkdir.c namei.c newdir.c read_bb.c read_bb_file.c rs_bitmap.c rw_bitmaps.c swapfs.c test_io.c tst_badblocks.c tst_iscan.c unix_io.c unlink.c valid_blk.c version.c: Add an #ifdef for HAVE_UNISTD_H
Diffstat (limited to 'lib/ext2fs')
-rw-r--r--lib/ext2fs/ChangeLog28
-rw-r--r--lib/ext2fs/alloc.c4
-rw-r--r--lib/ext2fs/alloc_tables.c2
-rw-r--r--lib/ext2fs/badblocks.c2
-rw-r--r--lib/ext2fs/bb_compat.c2
-rw-r--r--lib/ext2fs/bb_inode.c8
-rw-r--r--lib/ext2fs/bitmaps.c10
-rw-r--r--lib/ext2fs/block.c8
-rw-r--r--lib/ext2fs/bmove.c2
-rw-r--r--lib/ext2fs/brel_ma.c4
-rw-r--r--lib/ext2fs/check_desc.c2
-rw-r--r--lib/ext2fs/closefs.c2
-rw-r--r--lib/ext2fs/cmp_bitmaps.c2
-rw-r--r--lib/ext2fs/dblist.c2
-rw-r--r--lib/ext2fs/dblist_dir.c2
-rw-r--r--lib/ext2fs/dir_iterate.c2
-rw-r--r--lib/ext2fs/dirblock.c2
-rw-r--r--lib/ext2fs/dupfs.c2
-rw-r--r--lib/ext2fs/expanddir.c2
-rw-r--r--lib/ext2fs/ext2fs.h4
-rw-r--r--lib/ext2fs/freefs.c2
-rw-r--r--lib/ext2fs/get_pathname.c9
-rw-r--r--lib/ext2fs/icount.c2
-rw-r--r--lib/ext2fs/initialize.c2
-rw-r--r--lib/ext2fs/inline.c2
-rw-r--r--lib/ext2fs/inode.c2
-rw-r--r--lib/ext2fs/irel_ma.c4
-rw-r--r--lib/ext2fs/link.c2
-rw-r--r--lib/ext2fs/llseek.c4
-rw-r--r--lib/ext2fs/lookup.c2
-rw-r--r--lib/ext2fs/mkdir.c2
-rw-r--r--lib/ext2fs/namei.c2
-rw-r--r--lib/ext2fs/newdir.c2
-rw-r--r--lib/ext2fs/read_bb.c2
-rw-r--r--lib/ext2fs/read_bb_file.c2
-rw-r--r--lib/ext2fs/rs_bitmap.c2
-rw-r--r--lib/ext2fs/rw_bitmaps.c2
-rw-r--r--lib/ext2fs/swapfs.c2
-rw-r--r--lib/ext2fs/test_io.c2
-rw-r--r--lib/ext2fs/tst_badblocks.c2
-rw-r--r--lib/ext2fs/tst_iscan.c2
-rw-r--r--lib/ext2fs/unix_io.c2
-rw-r--r--lib/ext2fs/unlink.c2
-rw-r--r--lib/ext2fs/valid_blk.c2
-rw-r--r--lib/ext2fs/version.c2
45 files changed, 141 insertions, 12 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index 5733631a..8d463da0 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,31 @@
+Sun Aug 10 10:05:22 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * block.c (ext2fs_block_iterate2): Use retval which is a errcode_t
+ type.
+
+ * bitmaps.c (make_bitmap): Use size_t instead of int where
+ appropriate.
+
+ * bb_inode.c (set_bad_block_proc): Add #pragma argsused for Turbo C.
+
+ * alloc.c (ext2fs_new_inode): Use ino_t instead of int for the
+ group number.
+
+ * get_pathname.c: Use ino_t instead of int where appropriate.
+
+ * ext2fs.h: Make the magic structure element be errcode_t instead
+ of int.
+
+ * alloc.c alloc_tables.c badblocks.c bb_compat.c bb_inode.c
+ bitmaps.c block.c bmove.c brel_ma.c check_desc.c closefs.c
+ cmp_bitmaps.c dblist.c dblist_dir.c dir_iterate.c
+ dirblock.c dupfs.c expanddir.c freefs.c get_pathname.c
+ icount.c initialize.c inline.c inode.c irel_ma.c link.c
+ llseek.c lookup.c mkdir.c namei.c newdir.c read_bb.c
+ read_bb_file.c rs_bitmap.c rw_bitmaps.c swapfs.c
+ test_io.c tst_badblocks.c tst_iscan.c unix_io.c unlink.c
+ valid_blk.c version.c: Add an #ifdef for HAVE_UNISTD_H
+
Tue Jun 17 01:33:20 1997 Theodore Ts'o <tytso@rsts-11.mit.edu>
* unix_io.c (unix_read_blk): If ext2fs_llseek() fails, but errno
diff --git a/lib/ext2fs/alloc.c b/lib/ext2fs/alloc.c
index 50cee77c..308e3534 100644
--- a/lib/ext2fs/alloc.c
+++ b/lib/ext2fs/alloc.c
@@ -11,7 +11,9 @@
*/
#include <stdio.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <time.h>
#include <sys/stat.h>
@@ -33,7 +35,7 @@
errcode_t ext2fs_new_inode(ext2_filsys fs, ino_t dir, int mode,
ext2fs_inode_bitmap map, ino_t *ret)
{
- int dir_group = 0;
+ ino_t dir_group = 0;
ino_t i;
ino_t start_inode;
diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index 1c885571..a557db1e 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -12,7 +12,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/badblocks.c b/lib/ext2fs/badblocks.c
index 25444f0a..75f6df0a 100644
--- a/lib/ext2fs/badblocks.c
+++ b/lib/ext2fs/badblocks.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/bb_compat.c b/lib/ext2fs/bb_compat.c
index 38aeb8aa..2a2c1ecf 100644
--- a/lib/ext2fs/bb_compat.c
+++ b/lib/ext2fs/bb_compat.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/bb_inode.c b/lib/ext2fs/bb_inode.c
index a5dd3a96..7a9609ca 100644
--- a/lib/ext2fs/bb_inode.c
+++ b/lib/ext2fs/bb_inode.c
@@ -15,7 +15,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
@@ -154,6 +156,9 @@ cleanup:
* Clear the bad blocks in the bad block inode, while saving the
* indirect blocks.
*/
+#ifdef __TURBOC__
+#pragma argsused
+#endif
static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
blk_t ref_block, int ref_offset, void *private)
{
@@ -207,6 +212,9 @@ static int clear_bad_block_proc(ext2_filsys fs, blk_t *block_nr, int blockcnt,
*
* Set the block list in the bad block inode, using the supplied bitmap.
*/
+#ifdef __TURBOC__
+#pragma argsused
+#endif
static int set_bad_block_proc(ext2_filsys fs, blk_t *block_nr,
int blockcnt, blk_t ref_block,
int ref_offset, void *private)
diff --git a/lib/ext2fs/bitmaps.c b/lib/ext2fs/bitmaps.c
index defa0cdd..46b4ee66 100644
--- a/lib/ext2fs/bitmaps.c
+++ b/lib/ext2fs/bitmaps.c
@@ -12,7 +12,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
@@ -31,7 +33,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end,
ext2fs_generic_bitmap *ret)
{
ext2fs_generic_bitmap bitmap;
- int size;
+ size_t size;
bitmap = malloc(sizeof(struct ext2fs_struct_generic_bitmap));
if (!bitmap)
@@ -53,7 +55,7 @@ static errcode_t make_bitmap(__u32 start, __u32 end, __u32 real_end,
} else
bitmap->description = 0;
- size = ((bitmap->real_end - bitmap->start) / 8) + 1;
+ size = (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1);
bitmap->bitmap = malloc(size);
if (!bitmap->bitmap) {
free(bitmap->description);
@@ -187,7 +189,7 @@ void ext2fs_clear_inode_bitmap(ext2fs_inode_bitmap bitmap)
return;
memset(bitmap->bitmap, 0,
- ((bitmap->real_end - bitmap->start) / 8) + 1);
+ (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1));
}
void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
@@ -196,5 +198,5 @@ void ext2fs_clear_block_bitmap(ext2fs_block_bitmap bitmap)
return;
memset(bitmap->bitmap, 0,
- ((bitmap->real_end - bitmap->start) / 8) + 1);
+ (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1));
}
diff --git a/lib/ext2fs/block.c b/lib/ext2fs/block.c
index 03bf5f36..c1709d9b 100644
--- a/lib/ext2fs/block.c
+++ b/lib/ext2fs/block.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
@@ -321,9 +323,9 @@ errcode_t ext2fs_block_iterate2(ext2_filsys fs,
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
- ret = ext2fs_get_blocks(fs, ino, blocks);
- if (ret)
- return ret;
+ retval = ext2fs_get_blocks(fs, ino, blocks);
+ if (retval)
+ return retval;
ctx.fs = fs;
ctx.func = func;
diff --git a/lib/ext2fs/bmove.c b/lib/ext2fs/bmove.c
index c3554532..6bcd74d2 100644
--- a/lib/ext2fs/bmove.c
+++ b/lib/ext2fs/bmove.c
@@ -8,7 +8,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
diff --git a/lib/ext2fs/brel_ma.c b/lib/ext2fs/brel_ma.c
index a4258a70..aadd4f4f 100644
--- a/lib/ext2fs/brel_ma.c
+++ b/lib/ext2fs/brel_ma.c
@@ -13,8 +13,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_ERRNO_H
#include <errno.h>
+#endif
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/check_desc.c b/lib/ext2fs/check_desc.c
index 74b3e2d4..fca0bb46 100644
--- a/lib/ext2fs/check_desc.c
+++ b/lib/ext2fs/check_desc.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/closefs.c b/lib/ext2fs/closefs.c
index 4678d9ee..3883055c 100644
--- a/lib/ext2fs/closefs.c
+++ b/lib/ext2fs/closefs.c
@@ -10,7 +10,9 @@
*/
#include <stdio.h>
+#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 3d04a97e..21fe42aa 100644
--- a/lib/ext2fs/cmp_bitmaps.c
+++ b/lib/ext2fs/cmp_bitmaps.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/dblist.c b/lib/ext2fs/dblist.c
index 88763fc2..62739358 100644
--- a/lib/ext2fs/dblist.c
+++ b/lib/ext2fs/dblist.c
@@ -11,7 +11,9 @@
*/
#include <stdio.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/lib/ext2fs/dblist_dir.c b/lib/ext2fs/dblist_dir.c
index 10c7b58a..ebbf17af 100644
--- a/lib/ext2fs/dblist_dir.c
+++ b/lib/ext2fs/dblist_dir.c
@@ -11,7 +11,9 @@
*/
#include <stdio.h>
+#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 91f8ca67..40c289b1 100644
--- a/lib/ext2fs/dir_iterate.c
+++ b/lib/ext2fs/dir_iterate.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
diff --git a/lib/ext2fs/dirblock.c b/lib/ext2fs/dirblock.c
index 4db5b18c..4f8b94b2 100644
--- a/lib/ext2fs/dirblock.c
+++ b/lib/ext2fs/dirblock.c
@@ -10,7 +10,9 @@
*/
#include <stdio.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <time.h>
diff --git a/lib/ext2fs/dupfs.c b/lib/ext2fs/dupfs.c
index b2eee0b7..f7edd839 100644
--- a/lib/ext2fs/dupfs.c
+++ b/lib/ext2fs/dupfs.c
@@ -10,7 +10,9 @@
*/
#include <stdio.h>
+#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 852b40f5..39852c21 100644
--- a/lib/ext2fs/expanddir.c
+++ b/lib/ext2fs/expanddir.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
diff --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h
index 57dfacd3..8409e616 100644
--- a/lib/ext2fs/ext2fs.h
+++ b/lib/ext2fs/ext2fs.h
@@ -45,7 +45,7 @@ typedef unsigned int dgrp_t;
typedef struct struct_ext2_filsys *ext2_filsys;
struct ext2fs_struct_generic_bitmap {
- int magic;
+ errcode_t magic;
ext2_filsys fs;
__u32 start, end;
__u32 real_end;
@@ -119,7 +119,7 @@ typedef struct ext2_struct_dblist *ext2_dblist;
#define EXT2_NEW_INODE_FL 0x80000000
struct struct_ext2_filsys {
- int magic;
+ errcode_t magic;
io_channel io;
int flags;
char * device_name;
diff --git a/lib/ext2fs/freefs.c b/lib/ext2fs/freefs.c
index 43331aba..8d1da194 100644
--- a/lib/ext2fs/freefs.c
+++ b/lib/ext2fs/freefs.c
@@ -10,7 +10,9 @@
*/
#include <stdio.h>
+#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 8c94e932..adce2004 100644
--- a/lib/ext2fs/get_pathname.c
+++ b/lib/ext2fs/get_pathname.c
@@ -20,7 +20,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
@@ -31,12 +33,15 @@
#include "ext2fs.h"
struct get_pathname_struct {
- int search_ino;
- int parent;
+ ino_t search_ino;
+ ino_t parent;
char *name;
errcode_t errcode;
};
+#ifdef __TURBOC__
+#pragma argsused
+#endif
static int get_pathname_proc(struct ext2_dir_entry *dirent,
int offset,
int blocksize,
diff --git a/lib/ext2fs/icount.c b/lib/ext2fs/icount.c
index 7c686804..5bffc18a 100644
--- a/lib/ext2fs/icount.c
+++ b/lib/ext2fs/icount.c
@@ -10,7 +10,9 @@
*/
#include <et/com_err.h>
+#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 f9e744b3..c1f3608f 100644
--- a/lib/ext2fs/initialize.c
+++ b/lib/ext2fs/initialize.c
@@ -12,7 +12,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/inline.c b/lib/ext2fs/inline.c
index 3451c353..d5ee6839 100644
--- a/lib/ext2fs/inline.c
+++ b/lib/ext2fs/inline.c
@@ -14,7 +14,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 3806ac60..ddca41c7 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
diff --git a/lib/ext2fs/irel_ma.c b/lib/ext2fs/irel_ma.c
index 1bb3af6a..3a8538ca 100644
--- a/lib/ext2fs/irel_ma.c
+++ b/lib/ext2fs/irel_ma.c
@@ -13,8 +13,12 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#if HAVE_ERRNO_H
#include <errno.h>
+#endif
#include <linux/ext2_fs.h>
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c
index 933dfa83..63b11b45 100644
--- a/lib/ext2fs/link.c
+++ b/lib/ext2fs/link.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#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 71a9d910..986bf0be 100644
--- a/lib/ext2fs/llseek.c
+++ b/lib/ext2fs/llseek.c
@@ -12,14 +12,18 @@
#include <sys/types.h>
#include <errno.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "et/com_err.h"
#include "ext2fs/io.h"
#ifdef __linux__
#ifdef HAVE_LLSEEK
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <syscall.h>
#else /* HAVE_LLSEEK */
diff --git a/lib/ext2fs/lookup.c b/lib/ext2fs/lookup.c
index 5cded5ff..575806e1 100644
--- a/lib/ext2fs/lookup.c
+++ b/lib/ext2fs/lookup.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
diff --git a/lib/ext2fs/mkdir.c b/lib/ext2fs/mkdir.c
index 67a2046d..649f05ae 100644
--- a/lib/ext2fs/mkdir.c
+++ b/lib/ext2fs/mkdir.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/namei.c b/lib/ext2fs/namei.c
index ae39eecd..9824977c 100644
--- a/lib/ext2fs/namei.c
+++ b/lib/ext2fs/namei.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
diff --git a/lib/ext2fs/newdir.c b/lib/ext2fs/newdir.c
index 863960fa..074a7229 100644
--- a/lib/ext2fs/newdir.c
+++ b/lib/ext2fs/newdir.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#if HAVE_ERRNO_H
#include <errno.h>
diff --git a/lib/ext2fs/read_bb.c b/lib/ext2fs/read_bb.c
index 3fabddd2..6934ab9e 100644
--- a/lib/ext2fs/read_bb.c
+++ b/lib/ext2fs/read_bb.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/read_bb_file.c b/lib/ext2fs/read_bb_file.c
index 16c2e0b0..32a80838 100644
--- a/lib/ext2fs/read_bb_file.c
+++ b/lib/ext2fs/read_bb_file.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/rs_bitmap.c b/lib/ext2fs/rs_bitmap.c
index c41b5e65..02e3dd11 100644
--- a/lib/ext2fs/rs_bitmap.c
+++ b/lib/ext2fs/rs_bitmap.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/rw_bitmaps.c b/lib/ext2fs/rw_bitmaps.c
index e9bb58c4..bbde132a 100644
--- a/lib/ext2fs/rw_bitmaps.c
+++ b/lib/ext2fs/rw_bitmaps.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index de347ac3..b4330d63 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -10,7 +10,9 @@
*/
#include <stdio.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <time.h>
diff --git a/lib/ext2fs/test_io.c b/lib/ext2fs/test_io.c
index a82f0946..65c4d102 100644
--- a/lib/ext2fs/test_io.c
+++ b/lib/ext2fs/test_io.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/tst_badblocks.c b/lib/ext2fs/tst_badblocks.c
index d071406a..2063420e 100644
--- a/lib/ext2fs/tst_badblocks.c
+++ b/lib/ext2fs/tst_badblocks.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/tst_iscan.c b/lib/ext2fs/tst_iscan.c
index dbf0813a..2febe62e 100644
--- a/lib/ext2fs/tst_iscan.c
+++ b/lib/ext2fs/tst_iscan.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
index 2be3e703..0baae381 100644
--- a/lib/ext2fs/unix_io.c
+++ b/lib/ext2fs/unix_io.c
@@ -13,7 +13,9 @@
#include <stdio.h>
#include <string.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <fcntl.h>
#include <time.h>
diff --git a/lib/ext2fs/unlink.c b/lib/ext2fs/unlink.c
index e0309aa5..9c554232 100644
--- a/lib/ext2fs/unlink.c
+++ b/lib/ext2fs/unlink.c
@@ -11,7 +11,9 @@
#include <stdio.h>
#include <string.h>
+#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 3a0cb3eb..ff49f808 100644
--- a/lib/ext2fs/valid_blk.c
+++ b/lib/ext2fs/valid_blk.c
@@ -11,7 +11,9 @@
*/
#include <stdio.h>
+#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 38accf6b..9e489ec6 100644
--- a/lib/ext2fs/version.c
+++ b/lib/ext2fs/version.c
@@ -10,7 +10,9 @@
*/
#include <et/com_err.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include <stdlib.h>
#include <string.h>
#include <stdio.h>