From: Lennart Poettering Date: Mon, 25 Mar 2019 15:50:21 +0000 (+0100) Subject: namespace: get rid of {} around single-line if blocks X-Git-Tag: v242-rc1~62^2~4 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=867189b5456850a55e876ba31922aeb2568d786f;p=thirdparty%2Fsystemd.git namespace: get rid of {} around single-line if blocks --- diff --git a/src/core/namespace.c b/src/core/namespace.c index 8997fc170b8..c6179cdb173 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1058,30 +1058,29 @@ static int make_read_only(const MountEntry *m, char **blacklist, FILE *proc_self assert(proc_self_mountinfo); if (mount_entry_read_only(m)) { - if (IN_SET(m->mode, EMPTY_DIR, TMPFS)) { + if (IN_SET(m->mode, EMPTY_DIR, TMPFS)) r = remount_bind_readonly(mount_entry_path(m), m->flags); - } else { + else { submounts = true; r = bind_remount_recursive_with_mountinfo(mount_entry_path(m), true, blacklist, proc_self_mountinfo); } - } else if (m->mode == PRIVATE_DEV) { - /* Set /dev readonly, but not submounts like /dev/shm. Also, we only set the per-mount read-only flag. - * We can't set it on the superblock, if we are inside a user namespace and running Linux <= 4.17. */ + } else if (m->mode == PRIVATE_DEV) + /* Set /dev readonly, but not submounts like /dev/shm. Also, we only set the per-mount + * read-only flag. We can't set it on the superblock, if we are inside a user namespace and + * running Linux <= 4.17. */ r = remount_bind_readonly(mount_entry_path(m), DEV_MOUNT_OPTIONS); - } else + else return 0; - /* Not that we only turn on the MS_RDONLY flag here, we never turn it off. Something that was marked read-only - * already stays this way. This improves compatibility with container managers, where we won't attempt to undo - * read-only mounts already applied. */ + /* Not that we only turn on the MS_RDONLY flag here, we never turn it off. Something that was marked + * read-only already stays this way. This improves compatibility with container managers, where we + * won't attempt to undo read-only mounts already applied. */ if (r == -ENOENT && m->ignore) - r = 0; - + return 0; if (r < 0) return log_debug_errno(r, "Failed to re-mount '%s'%s read-only: %m", mount_entry_path(m), submounts ? " and its submounts" : ""); - return 0; }