]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
conf: cull_mntent_opt()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 1 Aug 2017 20:38:44 +0000 (22:38 +0200)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 15 Aug 2017 20:36:23 +0000 (16:36 -0400)
non-functional changes

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/conf.c

index 3ccfe0896280c2a726cb1e677dc1b5d395f860eb..73d378667c1710a59b771319c487abfff15666c5 100644 (file)
@@ -1762,28 +1762,27 @@ skipremount:
        return 0;
 }
 
-/*
- * Remove 'optional', 'create=dir', and 'create=file' from mntopt
- */
+/* Remove "optional", "create=dir", and "create=file" from mntopt */
 static void cull_mntent_opt(struct mntent *mntent)
 {
        int i;
-       char *p, *p2;
-       char *list[] = {"create=dir",
-                       "create=file",
-                       "optional",
-                       NULL };
-
-       for (i=0; list[i]; i++) {
-               if (!(p = strstr(mntent->mnt_opts, list[i])))
+       char *list[] = {"create=dir", "create=file", "optional", NULL};
+
+       for (i = 0; list[i]; i++) {
+               char *p, *p2;
+
+               p = strstr(mntent->mnt_opts, list[i]);
+               if (!p)
                        continue;
+
                p2 = strchr(p, ',');
                if (!p2) {
                        /* no more mntopts, so just chop it here */
                        *p = '\0';
                        continue;
                }
-               memmove(p, p2+1, strlen(p2+1)+1);
+
+               memmove(p, p2 + 1, strlen(p2 + 1) + 1);
        }
 }