summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2002-07-29 19:26:33 -0400
committerTheodore Ts'o <tytso@mit.edu>2002-07-29 19:26:33 -0400
commitfe4dd429dc878d877abe08c2c41eed48df4e4651 (patch)
treed51d6baf8dd5d5bb55e84182ed63f33678256696 /lib
parentcefbf4870c0593e3c7a01b8d5494463b247d90f0 (diff)
downloade2fsprogs-fe4dd429dc878d877abe08c2c41eed48df4e4651.tar.gz
link.c (ext2fs_link): When adding a new link to a directory,
clear the HTREE bit.
Diffstat (limited to 'lib')
-rw-r--r--lib/ext2fs/ChangeLog5
-rw-r--r--lib/ext2fs/link.c19
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index c946de5d..c8a00eb5 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,8 @@
+2002-07-29 Theodore Ts'o <tytso@mit.edu>
+
+ * link.c (ext2fs_link): When adding a new link to a directory,
+ clear the HTREE bit.
+
2002-07-23 Theodore Ts'o <tytso@mit.edu>
* dirhash.c (ext2fs_dirhash): Fix bug which caused MD4
diff --git a/lib/ext2fs/link.c b/lib/ext2fs/link.c
index 04ac00c7..5e0f4f3c 100644
--- a/lib/ext2fs/link.c
+++ b/lib/ext2fs/link.c
@@ -97,8 +97,9 @@ static int link_proc(struct ext2_dir_entry *dirent,
errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
ext2_ino_t ino, int flags)
{
- errcode_t retval;
- struct link_struct ls;
+ errcode_t retval;
+ struct link_struct ls;
+ struct ext2_inode inode;
EXT2_CHECK_MAGIC(fs, EXT2_ET_MAGIC_EXT2FS_FILSYS);
@@ -117,5 +118,17 @@ errcode_t ext2fs_link(ext2_filsys fs, ext2_ino_t dir, const char *name,
if (retval)
return retval;
- return (ls.done) ? 0 : EXT2_ET_DIR_NO_SPACE;
+ if (!ls.done)
+ return EXT2_ET_DIR_NO_SPACE;
+
+ if ((retval = ext2fs_read_inode(fs, dir, &inode)) != 0)
+ return retval;
+
+ if (inode.i_flags & EXT2_INDEX_FL) {
+ inode.i_flags &= ~EXT2_INDEX_FL;
+ if ((retval = ext2fs_write_inode(fs, dir, &inode)) != 0)
+ return retval;
+ }
+
+ return 0;
}