Index: trunk/src/emx/bsd/db/hash/hash.c
===================================================================
--- trunk/src/emx/bsd/db/hash/hash.c	(revision 276)
+++ trunk/src/emx/bsd/db/hash/hash.c	(revision 277)
@@ -519,5 +519,5 @@
 		if (wsize != sizeof(HASHHDR)) {
 			errno = EFTYPE;
-			hashp->errno = errno;
+			hashp->dbmerrno = errno; /* bird: errno */
 			return (-1);
 		}
@@ -550,5 +550,5 @@
 	hashp = (HTAB *)dbp->internal;
 	if (flag) {
-		hashp->errno = errno = EINVAL;
+		hashp->dbmerrno = errno = EINVAL;   /* bird: errno */
 		return (ERROR);
 	}
@@ -567,9 +567,9 @@
 	hashp = (HTAB *)dbp->internal;
 	if (flag && flag != R_NOOVERWRITE) {
-		hashp->errno = errno = EINVAL;
+		hashp->dbmerrno = errno = EINVAL;   /* bird: errno */
 		return (ERROR);
 	}
 	if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-		hashp->errno = errno = EPERM;
+		hashp->dbmerrno = errno = EPERM;    /* bird: errno */
 		return (ERROR);
 	}
@@ -588,9 +588,9 @@
 	hashp = (HTAB *)dbp->internal;
 	if (flag && flag != R_CURSOR) {
-		hashp->errno = errno = EINVAL;
+		hashp->dbmerrno = errno = EINVAL;   /* bird: errno */
 		return (ERROR);
 	}
 	if ((hashp->flags & O_ACCMODE) == O_RDONLY) {
-		hashp->errno = errno = EPERM;
+		hashp->dbmerrno = errno = EPERM;    /* bird: errno */
 		return (ERROR);
 	}
@@ -743,5 +743,5 @@
 	hashp = (HTAB *)dbp->internal;
 	if (flag && flag != R_FIRST && flag != R_NEXT) {
-		hashp->errno = errno = EINVAL;
+		hashp->dbmerrno = errno = EINVAL;   /* bird: errno */
 		return (ERROR);
 	}
Index: trunk/src/emx/bsd/db/hash/hash.h
===================================================================
--- trunk/src/emx/bsd/db/hash/hash.h	(revision 276)
+++ trunk/src/emx/bsd/db/hash/hash.h	(revision 277)
@@ -72,10 +72,10 @@
 	int		ssize;		/* Segment Size */
 	int		sshift;		/* Segment shift */
-	int		ovfl_point;	/* Where overflow pages are being 
+	int		ovfl_point;	/* Where overflow pages are being
 					 * allocated */
 	int		last_freed;	/* Last overflow page freed */
 	int		max_bucket;	/* ID of Maximum bucket in use */
 	int		high_mask;	/* Mask to modulo into entire table */
-	int		low_mask;	/* Mask to modulo into lower half of 
+	int		low_mask;	/* Mask to modulo into lower half of
 					 * table */
 	int		ffactor;	/* Fill factor */
@@ -83,8 +83,8 @@
 	int		hdrpages;	/* Size of table header */
 	int		h_charkey;	/* value of hash(CHARKEY) */
-#define NCACHED	32			/* number of bit maps and spare 
+#define NCACHED	32			/* number of bit maps and spare
 					 * points */
 	int		spares[NCACHED];/* spare pages for overflow */
-	u_int16_t	bitmaps[NCACHED];	/* address of overflow page 
+	u_int16_t	bitmaps[NCACHED];	/* address of overflow page
 						 * bitmaps */
 } HASHHDR;
@@ -93,5 +93,5 @@
 	HASHHDR 	hdr;		/* Header */
 	int		nsegs;		/* Number of allocated segments */
-	int		exsegs;		/* Number of extra allocated 
+	int		exsegs;		/* Number of extra allocated
 					 * segments */
 	u_int32_t			/* Hash function */
@@ -104,14 +104,15 @@
 	int		cbucket;	/* Current bucket */
 	int		cndx;		/* Index of next item on cpage */
-	int		errno;		/* Error Number -- for DBM 
+        /* bird: this used to be errno but that crashes with the errno define in errno.h and stdlib.h. */
+	int		dbmerrno;	/* Error Number -- for DBM
 					 * compatability */
-	int		new_file;	/* Indicates if fd is backing store 
+	int		new_file;	/* Indicates if fd is backing store
 					 * or no */
-	int		save_file;	/* Indicates whether we need to flush 
+	int		save_file;	/* Indicates whether we need to flush
 					 * file at
 					 * exit */
 	u_int32_t	*mapp[NCACHED];	/* Pointers to page maps */
 	int		nmaps;		/* Initial number of bitmaps */
-	int		nbufs;		/* Number of buffers left to 
+	int		nbufs;		/* Number of buffers left to
 					 * allocate */
 	BUFHEAD 	bufhead;	/* Header of buffer lru list */
@@ -233,5 +234,5 @@
  *		    OVFLPAGE -- 0
  *
- * FULL_KEY_DATA 
+ * FULL_KEY_DATA
  *		This must be the first key/data pair on the page.
  *		There are two cases:
Index: trunk/src/emx/bsd/db/hash/hash_page.c
===================================================================
--- trunk/src/emx/bsd/db/hash/hash_page.c	(revision 276)
+++ trunk/src/emx/bsd/db/hash/hash_page.c	(revision 277)
@@ -58,4 +58,5 @@
 #ifdef __EMX__
 #include <sys/param.h>
+#include <io.h>
 #endif /* __EMX__ */
 
Index: trunk/src/emx/bsd/db/hash/ndbm.c
===================================================================
--- trunk/src/emx/bsd/db/hash/ndbm.c	(revision 276)
+++ trunk/src/emx/bsd/db/hash/ndbm.c	(revision 277)
@@ -181,5 +181,5 @@
 
 	hp = (HTAB *)db->internal;
-	return (hp->errno);
+	return (hp->dbmerrno);          /* bird: errno */
 }
 
@@ -191,5 +191,5 @@
 
 	hp = (HTAB *)db->internal;
-	hp->errno = 0;
+	hp->dbmerrno = 0;               /* bird: errno */
 	return (0);
 }
Index: trunk/src/emx/bsd/db/recno/rec_close.c
===================================================================
--- trunk/src/emx/bsd/db/recno/rec_close.c	(revision 276)
+++ trunk/src/emx/bsd/db/recno/rec_close.c	(revision 277)
@@ -44,4 +44,7 @@
 #include <stdio.h>
 #include <unistd.h>
+#ifdef __EMX__
+#include <io.h>
+#endif
 
 #include <db.h>
