[Toybox] [PATCH 2/3] mount: ignore -o x-*

Isaac Dunham ibid.ag at gmail.com
Sat Mar 28 13:38:13 PDT 2015


mount: ignore -o x-*

According to the manpage for util-linux mount, this is a per-device
comment for programs that handle fstab; leaving it in causes failed
mounts.
util-linux mount also supports x-mount.mkdir[=mode], which allows
creating the mountpoint at mount (a possibly useful construction in
combination with -T, for simplified init scripts).
---
 toys/lsb/mount.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/toys/lsb/mount.c b/toys/lsb/mount.c
index 094b535..913a434 100644
--- a/toys/lsb/mount.c
+++ b/toys/lsb/mount.c
@@ -120,10 +120,13 @@ static long flag_opts(char *new, long flags, char **more)
 
     // If we didn't recognize it, keep string version
     if (more && i == ARRAY_LEN(opts)) {
-      i = *more ? strlen(*more) : 0;
-      *more = xrealloc(*more, i + strlen(new) + 2);
-      if (i) (*more)[i++] = ',';
-      strcpy(i+*more, new);
+      // -o x-* is a comment for other programs according to the mount manpage
+      if (strncmp(new, "x-", 2)) {
+        i = *more ? strlen(*more) : 0;
+        *more = xrealloc(*more, i + strlen(new) + 2);
+        if (i) (*more)[i++] = ',';
+        strcpy(i+*more, new);
+      } //TODO: handle x-mount.mkdir[=mode] option
     }
 
     if (!comma) break;
-- 
2.1.4


 1427575093.0


More information about the Toybox mailing list