From b80d30755caf8c51973e8775755ff1a9e1d582a5 Mon Sep 17 00:00:00 2001 From: Ben RUBSON Date: Sun, 25 Mar 2018 23:04:34 +0200 Subject: [PATCH] Correct a segfault in encfsctl (#498) The context must remain and not die just after init. Introduced in dcf8435d4c3d1926e65bcac7f07a7aaa6ca0a6ea. --- encfs/encfsctl.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/encfs/encfsctl.cpp b/encfs/encfsctl.cpp index 49369d7..7babf38 100644 --- a/encfs/encfsctl.cpp +++ b/encfs/encfsctl.cpp @@ -115,6 +115,8 @@ struct CommandOpts { gettext_noop(" -- print version number and exit")}, {0, 0, 0, 0, 0, 0}}; +auto ctx = std::make_shared(); + static void usage(const char *name) { cerr << autosprintf(_("encfsctl version %s"), VERSION) << "\n" << _("Usage:\n") @@ -252,7 +254,6 @@ static RootPtr initRootInfo(int &argc, char **&argv) { --argc; ++argv; - auto ctx = std::make_shared(); ctx->publicFilesystem = opts->ownerCreate; if (checkDir(opts->rootDir)) result = initFS(ctx.get(), opts); @@ -273,7 +274,6 @@ static RootPtr initRootInfo(const char *crootDir) { opts->createIfNotFound = false; opts->checkKey = false; - auto ctx = std::make_shared(); ctx->publicFilesystem = opts->ownerCreate; result = initFS(ctx.get(), opts); }