Commit 217686e9 authored by Al Viro's avatar Al Viro

fix affs parse_options()

Error handling in that sucker got broken back in 2003.  If function
returns 0 on failure, it's not nice to add return -EINVAL into it.
Adding return 1 on other failure exits is also not a good thing (and
yes, original success exits with 1 and some of failure exits with 0
are still there; so's the original logics in callers).
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 29333920
...@@ -203,7 +203,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s ...@@ -203,7 +203,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
switch (token) { switch (token) {
case Opt_bs: case Opt_bs:
if (match_int(&args[0], &n)) if (match_int(&args[0], &n))
return -EINVAL; return 0;
if (n != 512 && n != 1024 && n != 2048 if (n != 512 && n != 1024 && n != 2048
&& n != 4096) { && n != 4096) {
printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n"); printk ("AFFS: Invalid blocksize (512, 1024, 2048, 4096 allowed)\n");
...@@ -213,7 +213,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s ...@@ -213,7 +213,7 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
break; break;
case Opt_mode: case Opt_mode:
if (match_octal(&args[0], &option)) if (match_octal(&args[0], &option))
return 1; return 0;
*mode = option & 0777; *mode = option & 0777;
*mount_opts |= SF_SETMODE; *mount_opts |= SF_SETMODE;
break; break;
...@@ -231,21 +231,21 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s ...@@ -231,21 +231,21 @@ parse_options(char *options, uid_t *uid, gid_t *gid, int *mode, int *reserved, s
break; break;
case Opt_reserved: case Opt_reserved:
if (match_int(&args[0], reserved)) if (match_int(&args[0], reserved))
return 1; return 0;
break; break;
case Opt_root: case Opt_root:
if (match_int(&args[0], root)) if (match_int(&args[0], root))
return 1; return 0;
break; break;
case Opt_setgid: case Opt_setgid:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return 1; return 0;
*gid = option; *gid = option;
*mount_opts |= SF_SETGID; *mount_opts |= SF_SETGID;
break; break;
case Opt_setuid: case Opt_setuid:
if (match_int(&args[0], &option)) if (match_int(&args[0], &option))
return -EINVAL; return 0;
*uid = option; *uid = option;
*mount_opts |= SF_SETUID; *mount_opts |= SF_SETUID;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment