summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTopi Miettinen <topimiettinen@users.noreply.github.com>2016-07-20 14:43:21 +0000
committerEvgeny Vereshchagin <evvers@ya.ru>2016-07-20 17:43:21 +0300
commit176e51b7102d7bba875e58b85b59e2ed7e30bc89 (patch)
tree8795ddee65a2faa8e0b9e8edf1605307167c5e9f
parent01a326affde96a8b97ac3a250e9168224508bf0b (diff)
namespace: fix wrong return value from mount(2) (#3758)
Fix bug introduced by #3263: mount(2) return value is 0 or -1, not errno. Thanks to Evgeny Vereshchagin (@evverx) for reporting.
-rw-r--r--src/core/namespace.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/namespace.c b/src/core/namespace.c
index 8df82c031c..4baf4750f4 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -347,7 +347,8 @@ static int make_read_only(BindMount *m) {
else if (IN_SET(m->mode, READWRITE, PRIVATE_TMP, PRIVATE_VAR_TMP, PRIVATE_DEV)) {
r = bind_remount_recursive(m->path, false);
if (r == 0 && m->mode == PRIVATE_DEV) /* can be readonly but the submounts can't*/
- r = mount(NULL, m->path, NULL, MS_REMOUNT|DEV_MOUNT_OPTIONS|MS_RDONLY, NULL);
+ if (mount(NULL, m->path, NULL, MS_REMOUNT|DEV_MOUNT_OPTIONS|MS_RDONLY, NULL) < 0)
+ r = -errno;
} else
r = 0;