From 1cbc1e34f9d6ff762669a869efe9aa03020b085f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Oscar=20Megia=20L=C3=B3pez?= Date: Tue, 25 Apr 2023 19:55:53 +0200 Subject: [PATCH] Bug when mountpoint is not empty with -i option When user attempts to mount in a mountpoint that is not empty and added -i option, encfs exits with coredump SIGSEGV. With -i option, encfs needs also to check that fuse_main returned 0. --- encfs/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/encfs/main.cpp b/encfs/main.cpp index 71dfd71..e4173be 100644 --- a/encfs/main.cpp +++ b/encfs/main.cpp @@ -818,7 +818,10 @@ int main(int argc, char *argv[]) { RLOG(ERROR) << "Internal error: Caught unexpected exception"; } - if (ctx->args->idleTimeout > 0) { + // We need to check if returnCode is equal to EXIT_SUCCESS + // when directory is mounted, because if we do not check and + // user added -i option, it will exit with coredump SIGSEGV. + if (ctx->args->idleTimeout > 0 && returnCode == EXIT_SUCCESS) { ctx->running = false; // wake up the thread if it is waiting.. VLOG(1) << "waking up monitoring thread";