Skip to content

Commit

Permalink
Merge pull request #1309 from giuseppe/ignore-ENOTSUP-chmod
Browse files Browse the repository at this point in the history
utils: ignore ENOTSUP when chmod a symlink
  • Loading branch information
giuseppe authored Sep 25, 2023
2 parents 905552d + 57262a2 commit be16ee7
Showing 1 changed file with 2 additions and 12 deletions.
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;

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

0 comments on commit be16ee7

Please sign in to comment.