diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-11 23:40:46 -0500 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-01-11 23:41:42 -0500 |
commit | a75f4e2a02e287294b21ae9e5b1f28b2f8faea39 (patch) | |
tree | 76f9db5fdaf9774a0af34e3c226f4b581f375a46 /src/shared | |
parent | 7f76961982e03d4d5f781e7e7113fc7eff970f82 (diff) |
fstab-util: fix priority parsing and add test
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/fstab-util.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c index a886f6a5da..cf317e17bd 100644 --- a/src/shared/fstab-util.c +++ b/src/shared/fstab-util.c @@ -133,8 +133,10 @@ int fstab_find_pri(const char *options, int *ret) { assert(ret); r = fstab_filter_options(options, "pri\0", NULL, &opt, NULL); - if (r <= 0) + if (r < 0) return r; + if (r == 0 || !opt) + return 0; r = safe_atou(opt, &pri); if (r < 0) @@ -143,6 +145,6 @@ int fstab_find_pri(const char *options, int *ret) { if ((int) pri < 0) return -ERANGE; - *ret = (int) r; + *ret = (int) pri; return 1; } |