From 344c043b38689c5e394a8659b6ef63814eff7479 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sun, 17 May 2015 15:06:45 -0400 Subject: [PATCH] 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 --- misc/create_inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; -- 1.8.3.1