]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core:namespace: minor improvements to append_mounts()
authorDjalal Harouni <tixxdz@opendz.org>
Sun, 25 Sep 2016 09:03:21 +0000 (11:03 +0200)
committerDjalal Harouni <tixxdz@opendz.org>
Sun, 25 Sep 2016 09:03:21 +0000 (11:03 +0200)
src/core/namespace.c

index c9b2154985f4532113a4021beaeead4ab3144cc3..8de774e6f6f059a52867205fdb66fca3964ff091 100644 (file)
@@ -70,12 +70,11 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) {
         assert(p);
 
         STRV_FOREACH(i, strv) {
+                bool ignore = false;
 
-                (*p)->ignore = false;
-
-                if ((mode == INACCESSIBLE || mode == READONLY || mode == READWRITE) && (*i)[0] == '-') {
-                        (*p)->ignore = true;
+                if (IN_SET(mode, INACCESSIBLE, READONLY, READWRITE) && startswith(*i, "-")) {
                         (*i)++;
+                        ignore = true;
                 }
 
                 if (!path_is_absolute(*i))
@@ -83,6 +82,7 @@ static int append_mounts(BindMount **p, char **strv, MountMode mode) {
 
                 (*p)->path = *i;
                 (*p)->mode = mode;
+                (*p)->ignore = ignore;
                 (*p)++;
         }