mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-10 15:56:25 -04:00
fuse-overlayfs: fix order of lower layers
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
5b29022bd3
commit
24dd39ee72
21
main.c
21
main.c
@ -946,6 +946,7 @@ static struct ovl_layer *
|
|||||||
read_dirs (char *path, bool low, struct ovl_layer *layers)
|
read_dirs (char *path, bool low, struct ovl_layer *layers)
|
||||||
{
|
{
|
||||||
char *buf = NULL, *saveptr = NULL, *it;
|
char *buf = NULL, *saveptr = NULL, *it;
|
||||||
|
struct ovl_layer *last;
|
||||||
|
|
||||||
if (path == NULL)
|
if (path == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -954,6 +955,10 @@ read_dirs (char *path, bool low, struct ovl_layer *layers)
|
|||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
last = layers;
|
||||||
|
while (last && last->next)
|
||||||
|
last = last->next;
|
||||||
|
|
||||||
for (it = strtok_r (path, ":", &saveptr); it; it = strtok_r (NULL, ":", &saveptr))
|
for (it = strtok_r (path, ":", &saveptr); it; it = strtok_r (NULL, ":", &saveptr))
|
||||||
{
|
{
|
||||||
char full_path[PATH_MAX + 1];
|
char full_path[PATH_MAX + 1];
|
||||||
@ -987,9 +992,25 @@ read_dirs (char *path, bool low, struct ovl_layer *layers)
|
|||||||
}
|
}
|
||||||
|
|
||||||
l->low = low;
|
l->low = low;
|
||||||
|
if (low)
|
||||||
|
{
|
||||||
|
if (last == NULL)
|
||||||
|
{
|
||||||
|
last = layers = l;
|
||||||
|
l->next = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last->next = l;
|
||||||
|
last = l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
l->next = layers;
|
l->next = layers;
|
||||||
layers = l;
|
layers = l;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
free (buf);
|
free (buf);
|
||||||
return layers;
|
return layers;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user