network: make compare functions safe

As the variable 'line' is unsigned.
This commit is contained in:
Yu Watanabe 2018-08-01 01:15:23 +09:00
parent 5b316330be
commit ca52812a94
1 changed files with 6 additions and 1 deletions

View File

@ -36,7 +36,12 @@ static int network_config_compare_func(const void *a, const void *b) {
if (r != 0)
return r;
return y->line - x->line;
if (x->line < y->line)
return -1;
if (x->line > y->line)
return 1;
return 0;
}
const struct hash_ops network_config_hash_ops = {