Whamcloud - gitweb
pass2.c (strnlen): Provide strnlen if libc doesn't.
authorTheodore Ts'o <tytso@mit.edu>
Wed, 18 Dec 2002 23:28:10 +0000 (18:28 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 18 Dec 2002 23:28:10 +0000 (18:28 -0500)
e2fsck/ChangeLog
e2fsck/pass2.c

index c2ba5c3..ec07282 100644 (file)
@@ -4,6 +4,10 @@
                twice, and abort with an error if this is the case.
                (Address IBM Bugzilla bug #1226)
 
+2002-12-18  Theodore Ts'o  <tytso@mit.edu>
+
+       * pass2.c (strnlen): Provide strnlen if libc doesn't. 
+
 2003-11-19  Theodore Ts'o  <tytso@mit.edu>
 
        * unix.c (PRS): Print an error if more than one of the -p/-a, -n
index 8703a01..4813d88 100644 (file)
@@ -80,6 +80,21 @@ struct check_dir_struct {
        e2fsck_t ctx;
 };     
 
+#ifndef HAVE_STRNLEN
+/*
+ * Incredibly, libc5 doesn't appear to have strnlen.  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
+
 void e2fsck_pass2(e2fsck_t ctx)
 {
        struct ext2_super_block *sb = ctx->fs->super;