xattr-util: merge various getxattr()/listxattr() helpers into getxattr_at_malloc() + listxattr_at_malloc()
Unfortunately fgetxattr() and flistxattr() don't work via O_PATH fds. Let's thus add fallbacks to go via /proc/self/fd/ in these cases. Also, let's merge all the various flavours we have here into singular implementations that can do everything we need: 1. malloc() loop handling 2. by fd, by path, or combination (i.e. a proper openat() like API) 3. work on O_PATH
This commit is contained in:
@@ -127,7 +127,7 @@ static int show_cgroup_name(
|
||||
bool delegate = false;
|
||||
int r;
|
||||
|
||||
r = getxattr_malloc(path, "trusted.delegate", &b, false);
|
||||
r = lgetxattr_malloc(path, "trusted.delegate", &b);
|
||||
if (r < 0) {
|
||||
if (r != -ENODATA)
|
||||
log_debug_errno(r, "Failed to read trusted.delegate extended attribute: %m");
|
||||
|
||||
Reference in New Issue
Block a user