From: Daniel Golle Date: Mon, 13 Jul 2020 23:40:20 +0000 (+0100) Subject: jail: fix false return in case of nofail mount X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=8d5208f044ba9c8cd871f8cea9719fc699604a49;p=project%2Fprocd.git 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 --- 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,