Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

utils: ignore ENOTSUP when chmod a symlink #1309

Merged
merged 1 commit into from
Sep 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/libcrun/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2079,19 +2079,9 @@ copy_recursive_fd_to_fd (int srcdirfd, int dfd, const char *srcname, const char
ret = fchmodat (destdirfd, de->d_name, mode & ALLPERMS, AT_SYMLINK_NOFOLLOW);
if (UNLIKELY (ret < 0))
{
/* If the operation fails with ENOTSUP we are dealing with a symlink, so ignore it. */
if (errno == ENOTSUP)
{
proc_fd_path_t proc_path;
cleanup_close int fd = -1;

fd = openat (destdirfd, de->d_name, O_PATH | O_NOFOLLOW);
if (UNLIKELY (fd < 0))
return crun_make_error (err, errno, "open `%s/%s`", destname, de->d_name);

get_proc_self_fd_path (proc_path, fd);

ret = chmod (proc_path, mode & ALLPERMS);
}
return 0;
flouthoc marked this conversation as resolved.
Show resolved Hide resolved

if (UNLIKELY (ret < 0))
return crun_make_error (err, errno, "chmod `%s/%s`", destname, de->d_name);
Expand Down