diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2019-01-18 16:26:31 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-02-10 14:46:59 +0100 |
commit | 751db3b4cd09ba7f9352444b93600992493cbf28 (patch) | |
tree | b88b4172ee5884dd40ea94971c812810d338551a /src/shared/test-tables.h | |
parent | tree-wide: use -EINVAL for enum invalid values (diff) | |
download | systemd-751db3b4cd09ba7f9352444b93600992493cbf28.tar.xz systemd-751db3b4cd09ba7f9352444b93600992493cbf28.zip |
Return -EINVAL from _from_string() functions
We'd return -1 (-EPERM), even though we have a general rule to use real errno
values. The particular case that caught my attention was:
$ sudo udevadm control -l asdf
Failed to parse log priority 'asdf': Operation not permitted
... but "git grep 'r =.*_from_string' src/" return 110 hits. Confusingly, some
of the _from_string functions already return a proper errno value, so not all
of those are broken, but probably quite a few.
Diffstat (limited to 'src/shared/test-tables.h')
-rw-r--r-- | src/shared/test-tables.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/test-tables.h b/src/shared/test-tables.h index e68ec60497..90210b9b59 100644 --- a/src/shared/test-tables.h +++ b/src/shared/test-tables.h @@ -33,11 +33,11 @@ static inline void _test_table(const char *name, if (i >= 0 && i < size) { if (sparse) - assert_se(rev == i || rev == -1); + assert_se(rev == i || rev == -EINVAL); else assert_se(val != NULL && rev == i); } else - assert_se(val == NULL && rev == -1); + assert_se(val == NULL && rev == -EINVAL); } } |