From c5f8d135cf3555404f1c4df5617f94f4fc2bac87 Mon Sep 17 00:00:00 2001 From: Grzegorz Kostka Date: Wed, 26 Sep 2018 22:35:36 +0200 Subject: [PATCH] ext4: fix ext4_fsymlink creation Solve the problem with long symbolic links creation. Thanks to: @cobenhan --- src/ext4.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ext4.c b/src/ext4.c index ab7b61f9..b270361d 100644 --- a/src/ext4.c +++ b/src/ext4.c @@ -2474,15 +2474,16 @@ static int ext4_fsymlink_set(ext4_file *f, const void *buf, uint32_t size) memcpy(ref.inode->blocks, buf, size); ext4_inode_clear_flag(ref.inode, EXT4_INODE_FLAG_EXTENTS); } else { + uint64_t off; ext4_fs_inode_blocks_init(&f->mp->fs, &ref); r = ext4_fs_append_inode_dblk(&ref, &fblock, &sblock); if (r != EOK) goto Finish; - r = ext4_block_writebytes(f->mp->fs.bdev, 0, buf, size); + off = fblock * block_size; + r = ext4_block_writebytes(f->mp->fs.bdev, off, buf, size); if (r != EOK) goto Finish; - } /*Stop write back cache mode*/