fuse-overlayfs: error out if redirect_dir is specified

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano 2018-07-13 14:14:59 +02:00
parent 8b54d466e1
commit 04be2fced2
No known key found for this signature in database
GPG Key ID: E4730F97F60286ED

7
main.c
View File

@ -122,6 +122,7 @@ struct ovl_data
char *context; char *context;
char *upperdir; char *upperdir;
char *workdir; char *workdir;
char *redirect_dir;
int workdir_fd; int workdir_fd;
struct ovl_layer *layers; struct ovl_layer *layers;
@ -129,6 +130,8 @@ struct ovl_data
}; };
static const struct fuse_opt ovl_opts[] = { static const struct fuse_opt ovl_opts[] = {
{"redirect_dir=%s",
offsetof (struct ovl_data, redirect_dir), 0},
{"context=%s", {"context=%s",
offsetof (struct ovl_data, context), 0}, offsetof (struct ovl_data, context), 0},
{"lowerdir=%s", {"lowerdir=%s",
@ -3176,6 +3179,7 @@ main (int argc, char *argv[])
.gid_str = NULL, .gid_str = NULL,
.root = NULL, .root = NULL,
.lowerdir = NULL, .lowerdir = NULL,
.redirect_dir = NULL,
}; };
int ret = -1; int ret = -1;
struct fuse_args args = FUSE_ARGS_INIT (argc, newargv); struct fuse_args args = FUSE_ARGS_INIT (argc, newargv);
@ -3203,6 +3207,9 @@ main (int argc, char *argv[])
lo.debug = opts.debug; lo.debug = opts.debug;
if (lo.redirect_dir && strcmp (lo.redirect_dir, "off"))
error (EXIT_FAILURE, 0, "fuse-overlayfs only supports redirect_dir=off");
if (lo.upperdir == NULL) if (lo.upperdir == NULL)
error (EXIT_FAILURE, 0, "upperdir not specified"); error (EXIT_FAILURE, 0, "upperdir not specified");
else else