Whamcloud - gitweb
Deal with libc5's lack of strnlen.
authorTheodore Ts'o <tytso@mit.edu>
Mon, 27 Aug 2001 16:18:16 +0000 (12:18 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 27 Aug 2001 16:18:16 +0000 (12:18 -0400)
Stop checking for strdup in the configure script since we don't
care about that symbol.

ChangeLog
configure
configure.in
e2fsck/ChangeLog
e2fsck/pass1.c

index b36eb25..38785bb 100644 (file)
--- 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
index 3675cf2..8bfaaae 100644 (file)
--- a/configure
+++ b/configure
@@ -4620,7 +4620,7 @@ EOF
 
   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
index 2b8158c..a9ad429 100644 (file)
@@ -541,7 +541,7 @@ if test "$e2fsprogs_cv_struct_st_flags" = yes; then
          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
index 93648c4..e9ec982 100644 (file)
@@ -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
index 2792df7..085999a 100644 (file)
@@ -131,7 +131,7 @@ int e2fsck_pass1_check_device_inode(struct ext2_inode *inode)
         * 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 @@ int e2fsck_pass1_check_device_inode(struct ext2_inode *inode)
        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.