X Tutup
Skip to content

Commit c53e07e

Browse files
committed
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
1 parent c9d1c37 commit c53e07e

File tree

11 files changed

+190
-195
lines changed

11 files changed

+190
-195
lines changed

src/basic/cgroup-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ int cg_get_xattr_malloc(const char *controller, const char *path, const char *na
669669
if (r < 0)
670670
return r;
671671

672-
r = getxattr_malloc(fs, name, ret, false);
672+
r = lgetxattr_malloc(fs, name, ret);
673673
if (r < 0)
674674
return r;
675675

src/basic/os-util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ int open_extension_release(const char *root, const char *extension, char **ret_p
118118

119119
/* No xattr or cannot parse it? Then skip this. */
120120
_cleanup_free_ char *extension_release_xattr = NULL;
121-
k = fgetxattrat_fake_malloc(extension_release_fd, NULL, "user.extension-release.strict", AT_EMPTY_PATH, &extension_release_xattr);
121+
k = fgetxattr_malloc(extension_release_fd, "user.extension-release.strict", &extension_release_xattr);
122122
if (k < 0 && !ERRNO_IS_NOT_SUPPORTED(k) && k != -ENODATA)
123123
log_debug_errno(k,
124124
"Failed to read 'user.extension-release.strict' extended attribute from extension-release file %s/%s: %m",

0 commit comments

Comments
 (0)
X Tutup