Skip to content

Commit

Permalink
Unify error handling in lib/tst_net.c
Browse files Browse the repository at this point in the history
- Properly format caller file:line location

Signed-off-by: Martin Doucha <[email protected]>
Reviewed-by: Cyril Hrubis <[email protected]>
  • Loading branch information
mdoucha authored and metan-ucw committed Nov 10, 2020
1 parent cb05d6c commit 375e380
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/tst_net.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ void safe_getaddrinfo(const char *file, const int lineno, const char *src_addr,
{
int err = getaddrinfo(src_addr, port, hints, addr_info);

if (err)
tst_brk(TBROK, "%s:%d: getaddrinfo failed, %s", file, lineno,
gai_strerror(err));
if (err) {
tst_brk_(file, lineno, TBROK, "getaddrinfo failed, %s",
gai_strerror(err));
}

if (!*addr_info)
tst_brk(TBROK, "%s:%d: failed to get the address", file, lineno);
tst_brk_(file, lineno, TBROK, "failed to get the address");
}

0 comments on commit 375e380

Please sign in to comment.