Interpret octal escape codes in options
authorMiklos Szeredi <mszeredi@suse.cz>
Fri, 27 Jan 2012 15:42:13 +0000 (16:42 +0100)
committerMiklos Szeredi <mszeredi@suse.cz>
Fri, 27 Jan 2012 15:42:33 +0000 (16:42 +0100)
Requested by Jan Engelhardt

ChangeLog
lib/fuse_opt.c

index a923872641963aae2e6fabe0689c19351c85c424..e4ba2559bcc54479075f515d7846a49ef14c922f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-27  Miklos Szeredi <miklos@szeredi.hu>
+
+       * Interpret octal escape codes in options.  Requested by Jan
+       Engelhardt
+
 2012-01-26  Miklos Szeredi <miklos@szeredi.hu>
 
        * Add man pages for fusermount, mount.fuse and ulockmgr_server.
index b9127645c65d7fa732e6962bd21c9146974f9218..a2118cedc38c069facabb670dca3f2ba5ab24504 100644 (file)
@@ -309,9 +309,21 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
                                return -1;
                        d = opts;
                } else {
-                       if (s[0] == '\\' && s[1] != '\0')
+                       if (s[0] == '\\' && s[1] != '\0') {
                                s++;
-                       *d++ = *s;
+                               if (s[0] >= '0' && s[0] <= '3' &&
+                                   s[1] >= '0' && s[1] <= '7' &&
+                                   s[2] >= '0' && s[2] <= '7') {
+                                       *d++ = (s[0] - '0') * 0100 +
+                                               (s[1] - '0') * 0010 +
+                                               (s[2] - '0');
+                                       s += 2;
+                               } else {
+                                       *d++ = *s;
+                               }
+                       } else {
+                               *d++ = *s;
+                       }
                }
                s++;
        }