From: Theodore Ts'o Date: Sun, 17 May 2015 19:06:45 +0000 (-0400) Subject: create_inode: handle source symlinks with extended attributes X-Git-Tag: v1.43-WIP-2015-05-18~5 X-Git-Url: https://git.whamcloud.com/?a=commitdiff_plain;h=344c043b38689c5e394a8659b6ef63814eff7479;p=tools%2Fe2fsprogs.git create_inode: handle source symlinks with extended attributes We need to use lgetxattr(2) instead of getxattr(2) or attempts to create file systems with extended attributes will fail: set_inode_xattr: No data available while reading attribute "trusted.link" of "link" __populate_fs: No data available while setting xattrs for "link" mke2fs: No data available while populating file system Reported-by: Jack_Fewx@Dell.com Signed-off-by: Theodore Ts'o --- diff --git a/misc/create_inode.c b/misc/create_inode.c index 7d3c9e6..13e96d0 100644 --- a/misc/create_inode.c +++ b/misc/create_inode.c @@ -177,7 +177,7 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino, const char *name = &list[i]; char *value; - value_size = getxattr(filename, name, NULL, 0); + value_size = lgetxattr(filename, name, NULL, 0); if (value_size == -1) { retval = errno; com_err(__func__, retval, @@ -192,7 +192,7 @@ static errcode_t set_inode_xattr(ext2_filsys fs, ext2_ino_t ino, break; } - value_size = getxattr(filename, name, value, value_size); + value_size = lgetxattr(filename, name, value, value_size); if (value_size == -1) { ext2fs_free_mem(&value); retval = errno;