mirror of
https://github.com/containers/fuse-overlayfs.git
synced 2025-09-16 10:51:37 -04:00
plugins: load from default location
if no -o plugins is specified, load them from $PKGLIBEXECDIR (usually has the value /usr/libexec/fuse-overlayfs). Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
parent
3fa10346c3
commit
715a95c39d
@ -8,6 +8,8 @@ EXTRA_DIST = m4/gnulib-cache.m4 rpm/fuse-overlayfs.spec.template autogen.sh fuse
|
|||||||
|
|
||||||
CLEANFILES = fuse-overlayfs.1
|
CLEANFILES = fuse-overlayfs.1
|
||||||
|
|
||||||
|
AM_CPPFLAGS = -DPKGLIBEXECDIR='"$(pkglibexecdir)"'
|
||||||
|
|
||||||
fuse_overlayfs_CFLAGS = -I . -I $(abs_srcdir)/lib $(FUSE_CFLAGS)
|
fuse_overlayfs_CFLAGS = -I . -I $(abs_srcdir)/lib $(FUSE_CFLAGS)
|
||||||
fuse_overlayfs_LDFLAGS =
|
fuse_overlayfs_LDFLAGS =
|
||||||
fuse_overlayfs_LDADD = lib/libgnu.a $(FUSE_LIBS)
|
fuse_overlayfs_LDADD = lib/libgnu.a $(FUSE_LIBS)
|
||||||
|
39
main.c
39
main.c
@ -4938,6 +4938,36 @@ set_limits ()
|
|||||||
error (EXIT_FAILURE, errno, "cannot set nofile rlimit");
|
error (EXIT_FAILURE, errno, "cannot set nofile rlimit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
load_default_plugins ()
|
||||||
|
{
|
||||||
|
DIR *dp = NULL;
|
||||||
|
char *plugins = strdup ("");
|
||||||
|
|
||||||
|
dp = opendir (PKGLIBEXECDIR);
|
||||||
|
if (dp == NULL)
|
||||||
|
return plugins;
|
||||||
|
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
struct dirent *dent;
|
||||||
|
|
||||||
|
dent = readdir (dp);
|
||||||
|
if (dent == NULL)
|
||||||
|
break;
|
||||||
|
if (dent->d_type != DT_DIR)
|
||||||
|
{
|
||||||
|
char *new_plugins = NULL;
|
||||||
|
asprintf (&new_plugins, "%s/%s:%s", PKGLIBEXECDIR, dent->d_name, plugins);
|
||||||
|
free (plugins);
|
||||||
|
plugins = new_plugins;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir (dp);
|
||||||
|
|
||||||
|
return plugins;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
@ -5042,8 +5072,10 @@ main (int argc, char *argv[])
|
|||||||
error (EXIT_FAILURE, errno, "cannot convert %s", lo.timeout_str);
|
error (EXIT_FAILURE, errno, "cannot convert %s", lo.timeout_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lo.plugins)
|
if (lo.plugins == NULL)
|
||||||
lo.plugins_ctx = load_plugins (lo.plugins);
|
lo.plugins = load_default_plugins ();
|
||||||
|
|
||||||
|
lo.plugins_ctx = load_plugins (lo.plugins);
|
||||||
|
|
||||||
layers = read_dirs (&lo, lo.lowerdir, true, NULL);
|
layers = read_dirs (&lo, lo.lowerdir, true, NULL);
|
||||||
if (layers == NULL)
|
if (layers == NULL)
|
||||||
@ -5133,8 +5165,7 @@ err_out1:
|
|||||||
|
|
||||||
hash_free (lo.inodes);
|
hash_free (lo.inodes);
|
||||||
|
|
||||||
if (lo.plugins)
|
plugin_free_all (lo.plugins_ctx);
|
||||||
plugin_free_all (lo.plugins_ctx);
|
|
||||||
|
|
||||||
free_mapping (lo.uid_mappings);
|
free_mapping (lo.uid_mappings);
|
||||||
free_mapping (lo.gid_mappings);
|
free_mapping (lo.gid_mappings);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user