summaryrefslogtreecommitdiff
path: root/src/test/test-in-addr-util.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-03 15:49:40 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-06-06 09:52:52 +0200
commit61af1813446ced383490fac93e31d6ea3fd5d178 (patch)
tree794303862e894bd2a3664af3dd4fb7bcddddc7de /src/test/test-in-addr-util.c
parentdd6d433a4fddac424db6790c08532dd04babe35b (diff)
downloadsystemd-61af1813446ced383490fac93e31d6ea3fd5d178.tar.gz
basic/in-addr-util: drop check for prefix length in formatting function
The general rule should be to be strict when parsing data, but lenient when printing it. Or in other words, we should verify data in verification functions, but not when printing things. It doesn't make sense to refuse to print a value that we are using internally. We were tripping ourselves in some of the print functions: we want to report than an address was configured with too-long prefix, but the log line would use "n/a" if the prefix was too long. This is not useful. Most of the time, the removal of the check doesn't make any difference, because we verified the prefix length on input.
Diffstat (limited to 'src/test/test-in-addr-util.c')
-rw-r--r--src/test/test-in-addr-util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/test/test-in-addr-util.c b/src/test/test-in-addr-util.c
index c0808d51b9..296cd27434 100644
--- a/src/test/test-in-addr-util.c
+++ b/src/test/test-in-addr-util.c
@@ -351,7 +351,7 @@ static void test_in_addr_to_string_one(int f, const char *addr) {
assert_se(in_addr_from_string(f, addr, &ua) >= 0);
assert_se(in_addr_to_string(f, &ua, &r) >= 0);
- printf("test_in_addr_to_string_one: %s == %s\n", addr, r);
+ printf("%s: %s == %s\n", __func__, addr, r);
assert_se(streq(addr, r));
assert_se(streq(r, IN_ADDR_TO_STRING(f, &ua)));