mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-08-03 18:05:58 -04:00
main: fix layer lookup in make_ovl_node
Stop iterating through layers in `make_ovl_node` if the current layer being checked is the `last_layer` of the parent node. Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
28ba1fd247
commit
d5b2cec0e7
6
main.c
6
main.c
@ -1526,6 +1526,7 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
|
|||||||
struct ovl_layer *it;
|
struct ovl_layer *it;
|
||||||
cleanup_free char *npath = NULL;
|
cleanup_free char *npath = NULL;
|
||||||
char whiteout_path[PATH_MAX];
|
char whiteout_path[PATH_MAX];
|
||||||
|
bool stop_lookup = false;
|
||||||
|
|
||||||
npath = strdup (ret->path);
|
npath = strdup (ret->path);
|
||||||
if (npath == NULL)
|
if (npath == NULL)
|
||||||
@ -1536,13 +1537,16 @@ make_ovl_node (struct ovl_data *lo, const char *path, struct ovl_layer *layer, c
|
|||||||
else
|
else
|
||||||
strconcat3 (whiteout_path, PATH_MAX, "/.wh.", name, NULL);
|
strconcat3 (whiteout_path, PATH_MAX, "/.wh.", name, NULL);
|
||||||
|
|
||||||
for (it = layer; it; it = it->next)
|
for (it = layer; it && ! stop_lookup; it = it->next)
|
||||||
{
|
{
|
||||||
ssize_t s;
|
ssize_t s;
|
||||||
cleanup_free char *val = NULL;
|
cleanup_free char *val = NULL;
|
||||||
cleanup_free char *origin = NULL;
|
cleanup_free char *origin = NULL;
|
||||||
cleanup_close int fd = -1;
|
cleanup_close int fd = -1;
|
||||||
|
|
||||||
|
if (parent && parent->last_layer == it)
|
||||||
|
stop_lookup = true;
|
||||||
|
|
||||||
if (dir_p)
|
if (dir_p)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user