mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-04 02:15:58 -04:00
main: skip deleting dev whiteouts when unprivileged
do not attempt to delete device whiteouts when the process has not enough privileges to create them. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
c2aab54c83
commit
8d2aedcb19
7
main.c
7
main.c
@ -230,6 +230,9 @@ static const struct fuse_opt ovl_opts[] = {
|
|||||||
FUSE_OPT_END
|
FUSE_OPT_END
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* The current process has enough privileges to use mknod. */
|
||||||
|
static bool can_mknod = true;
|
||||||
|
|
||||||
/* Kernel definitions. */
|
/* Kernel definitions. */
|
||||||
|
|
||||||
typedef unsigned char u8;
|
typedef unsigned char u8;
|
||||||
@ -533,7 +536,6 @@ static int
|
|||||||
create_whiteout (struct ovl_data *lo, struct ovl_node *parent, const char *name, bool skip_mknod, bool force_create)
|
create_whiteout (struct ovl_data *lo, struct ovl_node *parent, const char *name, bool skip_mknod, bool force_create)
|
||||||
{
|
{
|
||||||
char whiteout_wh_path[PATH_MAX];
|
char whiteout_wh_path[PATH_MAX];
|
||||||
static bool can_mknod = true;
|
|
||||||
cleanup_close int fd = -1;
|
cleanup_close int fd = -1;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -590,6 +592,8 @@ delete_whiteout (struct ovl_data *lo, int dirfd, struct ovl_node *parent, const
|
|||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
if (can_mknod)
|
||||||
|
{
|
||||||
if (dirfd >= 0)
|
if (dirfd >= 0)
|
||||||
{
|
{
|
||||||
if (TEMP_FAILURE_RETRY (fstatat (dirfd, name, &st, AT_SYMLINK_NOFOLLOW)) == 0
|
if (TEMP_FAILURE_RETRY (fstatat (dirfd, name, &st, AT_SYMLINK_NOFOLLOW)) == 0
|
||||||
@ -616,6 +620,7 @@ delete_whiteout (struct ovl_data *lo, int dirfd, struct ovl_node *parent, const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Look for the .wh. alternative as well. */
|
/* Look for the .wh. alternative as well. */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user