parse-util: make parse_fd() return -EBADF

The previous error code -ERANGE is slightly ambiguous, and use more
specific one. This also drops unnecessary error handlings.

Follow-up for 754d8b9c33 and
e652663a04.
This commit is contained in:
Yu Watanabe
2023-05-08 09:49:55 +02:00
committed by Daan De Meyer
parent b3d12ac0da
commit d2132d3d8d
6 changed files with 4 additions and 13 deletions
+2 -2
View File
@@ -869,8 +869,8 @@ TEST(parse_fd) {
assert_se(parse_fd("0") == 0);
assert_se(parse_fd("1") == 1);
assert_se(parse_fd("-1") == -ERANGE);
assert_se(parse_fd("-3") == -ERANGE);
assert_se(parse_fd("-1") == -EBADF);
assert_se(parse_fd("-3") == -EBADF);
assert_se(parse_fd("") == -EINVAL);
assert_se(parse_fd("12.3") == -EINVAL);