[Ocfs2-tools-commits] zab commits r286 - trunk/fsck.ocfs2
svn-commits at oss.oracle.com
svn-commits at oss.oracle.com
Wed Sep 29 17:09:09 CDT 2004
Author: zab
Date: 2004-09-29 17:09:07 -0500 (Wed, 29 Sep 2004)
New Revision: 286
Modified:
trunk/fsck.ocfs2/pass2.c
Log:
o Make sure dirent names don't have nulls or slashes
Modified: trunk/fsck.ocfs2/pass2.c
===================================================================
--- trunk/fsck.ocfs2/pass2.c 2004-09-29 22:03:22 UTC (rev 285)
+++ trunk/fsck.ocfs2/pass2.c 2004-09-29 22:09:07 UTC (rev 286)
@@ -178,6 +178,27 @@
return OCFS2_DIRENT_CHANGED;
}
+static int fix_dirent_name(o2fsck_state *ost, o2fsck_dirblock_entry *dbe,
+ struct ocfs2_dir_entry *dirent, int offset)
+{
+ char *chr = dirent->name;
+ int len = dirent->name_len;
+ int fix = 0;
+
+ for(; len-- && (*chr == '/' || *chr == '\0'); chr++) {
+ /* XXX in %s parent name */
+ if (!fix) {
+ fix = should_fix(ost, FIX_DEFYES, "Entry '%*s' "
+ "contains invalid characters, replace "
+ "with dots?", dirent->name_len,
+ dirent->name);
+ if (!fix)
+ return 0;
+ }
+ *chr = '.';
+ }
+}
+
/* this could certainly be more clever to issue reads in groups */
static unsigned pass2_dir_block_iterate(o2fsck_dirblock_entry *dbe,
void *priv_data)
@@ -222,7 +243,10 @@
ret_flags |= fix_dirent_dots(dd->ost, dbe, dirent, offset,
dd->fs->fs_blocksize - offset);
+ if (ret_flags & OCFS2_DIRENT_ABORT)
+ break;
+ ret_flags |= fix_dirent_name(dd->ost, dbe, dirent, offset);
if (ret_flags & OCFS2_DIRENT_ABORT)
break;
More information about the Ocfs2-tools-commits
mailing list