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.
This commit is contained in:
parent
01a326affd
commit
176e51b710
|
@ -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)) {
|
else if (IN_SET(m->mode, READWRITE, PRIVATE_TMP, PRIVATE_VAR_TMP, PRIVATE_DEV)) {
|
||||||
r = bind_remount_recursive(m->path, false);
|
r = bind_remount_recursive(m->path, false);
|
||||||
if (r == 0 && m->mode == PRIVATE_DEV) /* can be readonly but the submounts can't*/
|
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
|
} else
|
||||||
r = 0;
|
r = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue