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:
committed by
Zbigniew Jędrzejewski-Szmek
parent
09e4b620e7
commit
7477451b69
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user