From 53abed0afafec661fd923cb9cd9f0eee891ccbde Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 27 Aug 2001 12:18:16 -0400 Subject: [PATCH] Deal with libc5's lack of strnlen. Stop checking for strdup in the configure script since we don't care about that symbol. --- ChangeLog | 6 ++++++ configure | 2 +- configure.in | 2 +- e2fsck/ChangeLog | 4 ++++ e2fsck/pass1.c | 17 ++++++++++++++++- 5 files changed, 28 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index b36eb25..38785bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2001-08-27 Theodore Tso + + * 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 * 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 @@ 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 diff --git a/configure.in b/configure.in index 2b8158c..a9ad429 100644 --- a/configure.in +++ b/configure.in @@ -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 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 + + * pass1.c (strnlen): Provide strnlen if libc doesn't. + 2001-08-13 Theodore Tso * 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 @@ 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. -- 1.8.3.1