4 * Copyright IBM, Corp. 2017
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #include "qemu/osdep.h"
14 #include "qemu/xattr.h"
17 int relative_openat_nofollow(int dirfd, const char *path, int flags,
32 /* Only relative paths without consecutive slashes */
33 assert(path[0] != '/');
35 head = g_strdup(path);
36 c = strchr(path, '/');
39 next_fd = openat_dir(fd, head);
41 next_fd = openat_file(fd, head, flags, mode);
45 close_preserve_errno(fd);
60 ssize_t fgetxattrat_nofollow(int dirfd, const char *filename, const char *name,
61 void *value, size_t size)
63 char *proc_path = g_strdup_printf("/proc/self/fd/%d/%s", dirfd, filename);
66 ret = lgetxattr(proc_path, name, value, size);