Deal with libc5's lack of strnlen.

Stop checking for strdup in the configure script since we don't 
care about that symbol.

diff --git a/ChangeLog b/ChangeLog
index b36eb25..38785bb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2001-08-27  Theodore Tso  <tytso@valinux.com>
+
+	* configure.in: Check for the presence of strnlen.  Stop checking
+		for strdup, since we don't actually care about that symbol
+		any more.
+
 2001-08-04  Andreas Dilger  <root@lynx.adilger.int>
 
 	* Makefile.in: Add "*.orig" to "make clean" target, change
diff --git a/configure b/configure
index 3675cf2..8bfaaae 100644
--- a/configure
+++ b/configure
@@ -4620,7 +4620,7 @@
 
   fi
 fi
-for ac_func in chflags getrusage llseek lseek64 open64 strdup getmntinfo strcasecmp srandom fchown mallinfo fdatasync
+for ac_func in chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
 echo "configure:4627: checking for $ac_func" >&5
diff --git a/configure.in b/configure.in
index 2b8158c..a9ad429 100644
--- a/configure.in
+++ b/configure.in
@@ -541,7 +541,7 @@
 	  AC_DEFINE(HAVE_STAT_FLAGS)
   fi
 fi
-AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 strdup getmntinfo strcasecmp srandom fchown mallinfo fdatasync)
+AC_CHECK_FUNCS(chflags getrusage llseek lseek64 open64 getmntinfo strcasecmp srandom fchown mallinfo fdatasync strnlen)
 dnl
 dnl Check to see if -lsocket is required (solaris) to make something
 dnl that uses socket() to compile; this is needed for the UUID library
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index 93648c4..e9ec982 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,7 @@
+2001-08-27  Theodore Tso  <tytso@valinux.com>
+
+	* pass1.c (strnlen): Provide strnlen if libc doesn't.
+
 2001-08-13  Theodore Tso  <tytso@valinux.com>
 
 	* super.c (release_orphan_inodes): If the filesystem contains
diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c
index 2792df7..085999a 100644
--- a/e2fsck/pass1.c
+++ b/e2fsck/pass1.c
@@ -131,7 +131,7 @@
 	 * If i_blocks is non-zero, then this is a bogus device/fifo/socket
 	 */
 	if (inode->i_blocks)
-		return 1;
+		return 0;
 	/*
 	 * We should be able to do the test below all the time, but
 	 * because the kernel doesn't forcibly clear the device
@@ -151,6 +151,21 @@
 	return 1;
 }
 
+#ifndef HAVE_STRNLEN
+/*
+ * Incredibly, libc5 doesn't appear to have strncpy.  So we have to
+ * provide our own.
+ */
+static int strnlen(const char * s, int count)
+{
+	const char *cp = s;
+
+	while (count-- && *cp)
+		cp++;
+	return cp - s;
+}
+#endif
+
 /*
  * Check to make sure a symlink inode is real.  Returns 1 if the symlink
  * checks out, 0 if not.