fstab-util: fix priority parsing and add test

This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2015-01-11 23:41:42 -05:00
parent 7f76961982
commit a75f4e2a02
2 changed files with 21 additions and 2 deletions
+4 -2
View File
@@ -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;
}