ext4: fix ext4_fsymlink creation
authorGrzegorz Kostka <kostka.grzegorz@gmail.com>
Wed, 26 Sep 2018 20:35:36 +0000 (22:35 +0200)
committerGrzegorz Kostka <kostka.grzegorz@gmail.com>
Wed, 26 Sep 2018 20:35:36 +0000 (22:35 +0200)
Solve the problem with long symbolic links creation.
Thanks to: @cobenhan

src/ext4.c

index ab7b61f9e6b0fd3b14dd88eae2bb256ed6c0d7bf..b270361d331783ca580555d138591caa741f44ae 100644 (file)
@@ -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*/