Skip to content

Commit a9a8b7b

Browse files
committed
selftests: Add missing newline in nettest error messages
A few logging lines are missing the newline, or need it moved up for cleaner logging. Signed-off-by: David Ahern <dsahern@gmail.com>
1 parent dbaa8aa commit a9a8b7b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

tools/testing/selftests/net/nettest.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ static void log_address(const char *desc, struct sockaddr *sa)
199199
if (sa->sa_family == AF_INET) {
200200
struct sockaddr_in *s = (struct sockaddr_in *) sa;
201201

202-
log_msg("%s %s:%d",
202+
log_msg("%s %s:%d\n",
203203
desc,
204204
inet_ntop(AF_INET, &s->sin_addr, addrstr,
205205
sizeof(addrstr)),
@@ -208,15 +208,13 @@ static void log_address(const char *desc, struct sockaddr *sa)
208208
} else if (sa->sa_family == AF_INET6) {
209209
struct sockaddr_in6 *s6 = (struct sockaddr_in6 *) sa;
210210

211-
log_msg("%s [%s]:%d",
211+
log_msg("%s [%s]:%d\n",
212212
desc,
213213
inet_ntop(AF_INET6, &s6->sin6_addr, addrstr,
214214
sizeof(addrstr)),
215215
ntohs(s6->sin6_port));
216216
}
217217

218-
printf("\n");
219-
220218
fflush(stdout);
221219
}
222220

@@ -594,7 +592,7 @@ static int expected_addr_match(struct sockaddr *sa, void *expected,
594592
struct in_addr *exp_in = (struct in_addr *) expected;
595593

596594
if (s->sin_addr.s_addr != exp_in->s_addr) {
597-
log_error("%s address does not match expected %s",
595+
log_error("%s address does not match expected %s\n",
598596
desc,
599597
inet_ntop(AF_INET, exp_in,
600598
addrstr, sizeof(addrstr)));
@@ -605,14 +603,14 @@ static int expected_addr_match(struct sockaddr *sa, void *expected,
605603
struct in6_addr *exp_in = (struct in6_addr *) expected;
606604

607605
if (memcmp(&s6->sin6_addr, exp_in, sizeof(*exp_in))) {
608-
log_error("%s address does not match expected %s",
606+
log_error("%s address does not match expected %s\n",
609607
desc,
610608
inet_ntop(AF_INET6, exp_in,
611609
addrstr, sizeof(addrstr)));
612610
rc = 1;
613611
}
614612
} else {
615-
log_error("%s address does not match expected - unknown family",
613+
log_error("%s address does not match expected - unknown family\n",
616614
desc);
617615
rc = 1;
618616
}
@@ -731,7 +729,7 @@ static int convert_addr(struct sock_args *args, const char *_str,
731729
}
732730
break;
733731
default:
734-
log_error("unknown address type");
732+
log_error("unknown address type\n");
735733
exit(1);
736734
}
737735

0 commit comments

Comments
 (0)