diff options
author | Misono Tomohiro <misono.tomohiro@jp.fujitsu.com> | 2018-04-02 10:59:31 +0900 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2018-04-06 15:06:50 +0200 |
commit | eb9dd12d0ed77aae427f7c348fd3cd1ab153ed9c (patch) | |
tree | 9f8c0fa467f696366df340a7cbefe879cccc05d4 | |
parent | 6cedd688115d85e6f14a43f7653378749ef31624 (diff) | |
download | btrfs-progs-eb9dd12d0ed77aae427f7c348fd3cd1ab153ed9c.tar.gz btrfs-progs-eb9dd12d0ed77aae427f7c348fd3cd1ab153ed9c.tar.bz2 btrfs-progs-eb9dd12d0ed77aae427f7c348fd3cd1ab153ed9c.zip |
btrfs-progs: mkfs rootdir: use lgetxattr() not to follow a symbolic link
mkfs-test 016 "rootdir-bad-symbolic-link" fails when selinux is enabled.
This is because add_xattr_item() uses getxattr() and tries to follow a
bad symbolic link for selinux item, which causes ENOENT error.
The line above already uses llistxattr() for getting list of xattr in
order not to follow a symbolic link, so just use lgetxattr() too.
Signed-off-by: Tomohiro Misono <misono.tomohiro@jp.fujitsu.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
-rw-r--r-- | mkfs/rootdir.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mkfs/rootdir.c b/mkfs/rootdir.c index 33c3ff1e..ff00bb0f 100644 --- a/mkfs/rootdir.c +++ b/mkfs/rootdir.c @@ -249,7 +249,7 @@ static int add_xattr_item(struct btrfs_trans_handle *trans, cur_name_len = strlen(cur_name); next_location += cur_name_len + 1; - ret = getxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX); + ret = lgetxattr(file_name, cur_name, cur_value, XATTR_SIZE_MAX); if (ret < 0) { if (errno == ENOTSUP) return 0; |