core: swap priority can be negative

Negative priorities are useful for swap targets which should be only used as
last resort.
This commit is contained in:
Topi Miettinen
2019-12-04 08:57:08 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 09e4b620e7
commit 7477451b69
4 changed files with 13 additions and 11 deletions
+3 -7
View File
@@ -186,8 +186,7 @@ int fstab_extract_values(const char *opts, const char *name, char ***values) {
int fstab_find_pri(const char *options, int *ret) {
_cleanup_free_ char *opt = NULL;
int r;
unsigned pri;
int r, pri;
assert(ret);
@@ -197,14 +196,11 @@ int fstab_find_pri(const char *options, int *ret) {
if (r == 0 || !opt)
return 0;
r = safe_atou(opt, &pri);
r = safe_atoi(opt, &pri);
if (r < 0)
return r;
if ((int) pri < 0)
return -ERANGE;
*ret = (int) pri;
*ret = pri;
return 1;
}