mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-12 16:57:05 -04:00
containerfs: fix fd leak
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
003d569b74
commit
d7f52737d3
10
main.c
10
main.c
@ -1521,12 +1521,20 @@ do_rm (fuse_req_t req, fuse_ino_t parent, const char *name, bool dirp)
|
|||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
size_t c = 0;
|
size_t c = 0;
|
||||||
int fd = openat (get_upper_layer (lo)->fd, node->path, O_DIRECTORY);
|
int fd;
|
||||||
|
|
||||||
|
fd = openat (get_upper_layer (lo)->fd, node->path, O_DIRECTORY);
|
||||||
|
if (fd < 0)
|
||||||
|
{
|
||||||
|
fuse_reply_err (req, errno);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (node->children)
|
if (node->children)
|
||||||
c = count_dir_entries (node);
|
c = count_dir_entries (node);
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
|
close (fd);
|
||||||
fuse_reply_err (req, ENOTEMPTY);
|
fuse_reply_err (req, ENOTEMPTY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user