Skip to content

Commit

Permalink
utils: ignore ENOTSUP when chmod a symlink
Browse files Browse the repository at this point in the history
commit 5d1f903f75a80daa4dfb3d84e114ec8ecbf29956 in the kernel, present
in a release since Linux 6.6 doesn't allow anymore to change the
mode of a symlink, so just ignore the failure.

Closes: containers#1308

Signed-off-by: Giuseppe Scrivano <[email protected]>
  • Loading branch information
giuseppe committed Sep 22, 2023
1 parent 905552d commit 0b2bf5e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libcrun/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -2091,6 +2091,10 @@ copy_recursive_fd_to_fd (int srcdirfd, int dfd, const char *srcname, const char
get_proc_self_fd_path (proc_path, fd);

ret = chmod (proc_path, mode & ALLPERMS);
/* If the operation is still not supported, we are dealing with a
symlink, so ignore it. */
if (ret < 0 && errno == ENOTSUP)
return 0;
}

if (UNLIKELY (ret < 0))
Expand Down

0 comments on commit 0b2bf5e

Please sign in to comment.