From: Theodore Ts'o Date: Mon, 19 Jan 2015 21:37:04 +0000 (-0500) Subject: Merge branch 'maint' into next X-Git-Tag: v1.43-WIP-2015-05-18~97 X-Git-Url: http://git.ipfire.org/?p=thirdparty%2Fe2fsprogs.git;a=commitdiff_plain;h=560080272fade0600bc0c1d981fb2c91e68f916c Merge branch 'maint' into next --- 560080272fade0600bc0c1d981fb2c91e68f916c diff --cc lib/ext2fs/symlink.c index 0732afe4d,7c485a5fd..279f48b45 --- a/lib/ext2fs/symlink.c +++ b/lib/ext2fs/symlink.c @@@ -91,28 -85,10 +91,28 @@@ errcode_t ext2fs_symlink(ext2_filsys fs if (fastlink) { /* Fast symlinks, target stored in inode */ strcpy((char *)&inode.i_block, target); + } else if (inlinelink) { + /* Try inserting an inline data symlink */ + inode.i_flags |= EXT4_INLINE_DATA_FL; + retval = ext2fs_write_new_inode(fs, ino, &inode); + if (retval) + goto cleanup; + retval = ext2fs_inline_data_set(fs, ino, &inode, target, + target_len); + if (retval) { + inode.i_flags &= ~EXT4_INLINE_DATA_FL; + inlinelink = 0; + goto need_block; + } + retval = ext2fs_read_inode(fs, ino, &inode); + if (retval) + goto cleanup; } else { +need_block: + ext2fs_iblk_set(fs, &inode, 1); /* Slow symlinks, target stored in the first block */ memset(block_buf, 0, fs->blocksize); - strcpy(block_buf, target); + strncpy(block_buf, target, fs->blocksize); if (fs->super->s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS) { /*