summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Golle2020-07-13 23:40:20 +0000
committerDaniel Golle2020-07-13 23:40:20 +0000
commit8d5208f044ba9c8cd871f8cea9719fc699604a49 (patch)
tree1227229a8d0d00cb0dfa5ba4d65d0f07321e237d
parentb2230e4ff28b29472d0a232fee5d9f4168390b52 (diff)
downloadprocd-8d5208f044ba9c8cd871f8cea9719fc699604a49.tar.gz
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 <daniel@makrotopia.org>
-rw-r--r--jail/fs.c5
1 files 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,