mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-09 07:16:11 -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
25
main.c
25
main.c
@ -946,6 +946,7 @@ static struct ovl_layer *
|
||||
read_dirs (char *path, bool low, struct ovl_layer *layers)
|
||||
{
|
||||
char *buf = NULL, *saveptr = NULL, *it;
|
||||
struct ovl_layer *last;
|
||||
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
@ -954,6 +955,10 @@ read_dirs (char *path, bool low, struct ovl_layer *layers)
|
||||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
last = layers;
|
||||
while (last && last->next)
|
||||
last = last->next;
|
||||
|
||||
for (it = strtok_r (path, ":", &saveptr); it; it = strtok_r (NULL, ":", &saveptr))
|
||||
{
|
||||
char full_path[PATH_MAX + 1];
|
||||
@ -987,8 +992,24 @@ read_dirs (char *path, bool low, struct ovl_layer *layers)
|
||||
}
|
||||
|
||||
l->low = low;
|
||||
l->next = layers;
|
||||
layers = l;
|
||||
if (low)
|
||||
{
|
||||
if (last == NULL)
|
||||
{
|
||||
last = layers = l;
|
||||
l->next = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
last->next = l;
|
||||
last = l;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
l->next = layers;
|
||||
layers = l;
|
||||
}
|
||||
}
|
||||
free (buf);
|
||||
return layers;
|
||||
|
Loading…
x
Reference in New Issue
Block a user