From 8d5208f044ba9c8cd871f8cea9719fc699604a49 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Tue, 14 Jul 2020 00:40:20 +0100 Subject: [PATCH] jail: fix false return in case of nofail mount In some cases mounts could still fail eventhough 'nofail' was set. Make sure to always return successfull also in those cases. Signed-off-by: Daniel Golle --- jail/fs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jail/fs.c b/jail/fs.c index 3f090dd..05f1fa7 100644 --- a/jail/fs.c +++ b/jail/fs.c @@ -98,7 +98,7 @@ static int do_mount(const char *root, const char *source, const char *target, co fd = creat(new, 0644); if (fd == -1) { ERROR("creat(%s) failed: %m\n", new); - return -1; + return error; } close(fd); } @@ -106,13 +106,14 @@ static int do_mount(const char *root, const char *source, const char *target, co if (mountflags & MS_BIND) { if (mount(source, new, filesystemtype, MS_BIND, optstr)) { ERROR("failed to mount -B %s %s: %m\n", source, new); + return error; } mountflags |= MS_REMOUNT; } if (mount(source, new, filesystemtype, mountflags, optstr)) { ERROR("failed to mount %s %s: %m\n", source, new); - return -1; + return error; } DEBUG("mount %s%s %s (%s)\n", (mountflags & MS_BIND)?"-B ":"", source, new, -- 2.30.2