Fix option parsing in mount.fuse
authorMiklos Szeredi <miklos@szeredi.hu>
Sat, 13 Jan 2007 18:47:24 +0000 (18:47 +0000)
committerMiklos Szeredi <miklos@szeredi.hu>
Sat, 13 Jan 2007 18:47:24 +0000 (18:47 +0000)
ChangeLog
util/mount.fuse

index 26f809cd6686f0d43dd7a37c49a47c4ae8a4964b..350e5750ccde4ce21ec2e09b30313ce0d643a7ad 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2006-01-13  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Fix option parsing in mount.fuse.  Patch from Jens M. Noedler
+
 2006-12-16  Miklos Szeredi <miklos@szeredi.hu>
 
        * kernel: don't keep unreferenced inodes in the icache.
index 2a74449bc9b28ad04fdc2303330bb45c7fa476af..1d87d1f17911151415959cf51b06baa19883dba6 100644 (file)
@@ -6,7 +6,7 @@
 # to kick me to the right way
 #
 
-VERSION="0.0.1"
+VERSION="0.0.2"
 PRGNAME=`basename $0`
 
 if [ -z "$HOME" ]; then
@@ -47,9 +47,19 @@ shift
 
 eval `echo $@ | sed -n "s/\([^,]*,\)*setuid=\([^,]*\).*/SETUID=\2/p"`
 
-ignore_opts='\(user\|nouser\|users\|auto\|noauto\|_netdev\|setuid=[^,]*\)'
+ignore_opts='\(-o\|user\|nouser\|users\|auto\|noauto\|_netdev\|setuid=[^,]*\)'
 
-OPTIONS=`echo $@ | sed "s/,${ignore_opts}\|${ignore_opts},//g"`
+# loop over each mount option and skip all that should be ignored
+IFS=","
+for OPT in $@; do
+       OPT=`echo $OPT | sed "s/^$ignore_opts$/IGNORE/"`
+       if [ "$OPT" == "IGNORE" ]; then continue; fi
+       OPTIONS="$OPTIONS$OPT,"
+done
+IFS=" "
+
+# add "-o " and remove trailing comma
+OPTIONS="-o `echo $OPTIONS | sed "s/,$//"`"
 
 if test -z "$SETUID"; then
     ${FSTYPE} ${MOUNTPATH} ${MOUNTPOINT} ${OPTIONS}