dcavalca / rpms / systemd

Forked from rpms/systemd 4 months ago
Clone
Blob Blame History Raw
From ff699dcd6f4e665119afa7ac0a9446907d02c966 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 7 Nov 2016 08:57:30 -0500
Subject: [PATCH] nspawn: slight simplification

(cherry picked from commit 46c3230dd0985062f06341809faa05e73fa1ccd1)
---
 src/core/namespace.c | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/src/core/namespace.c b/src/core/namespace.c
index 524416ecbd..b18fcf3e29 100644
--- a/src/core/namespace.c
+++ b/src/core/namespace.c
@@ -154,10 +154,10 @@ static const TargetMount protect_system_strict_table[] = {
         { "/root",      READWRITE,      true  },      /* ProtectHome= */
 };
 
-static void set_bind_mount(BindMount **p, char *path, MountMode mode, bool ignore) {
-        (*p)->path = path;
-        (*p)->mode = mode;
-        (*p)->ignore = ignore;
+static void set_bind_mount(BindMount *p, char *path, MountMode mode, bool ignore) {
+        p->path = path;
+        p->mode = mode;
+        p->ignore = ignore;
 }
 
 static int append_one_mount(BindMount **p, const char *root_directory,
@@ -169,9 +169,7 @@ static int append_one_mount(BindMount **p, const char *root_directory,
         if (!lpath)
                 return -ENOMEM;
 
-        set_bind_mount(p, lpath, mode, ignore);
-        (*p)++;
-
+        set_bind_mount((*p)++, lpath, mode, ignore);
         return 0;
 }
 
@@ -196,8 +194,7 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) {
                 if (!path)
                         return -ENOMEM;
 
-                set_bind_mount(p, path, mode, ignore);
-                (*p)++;
+                set_bind_mount((*p)++, path, mode, ignore);
         }
 
         return 0;
@@ -224,8 +221,7 @@ static int append_target_mounts(BindMount **p, const char *root_directory, const
                 if (!path_is_absolute(path))
                         return -EINVAL;
 
-                set_bind_mount(p, path, m->mode, m->ignore);
-                (*p)++;
+                set_bind_mount((*p)++, path, m->mode, m->ignore);
         }
 
         return 0;