_cleanup_close_ int fd = -1;
fd = socket(AF_INET, SOCK_STREAM | SOCK_CLOEXEC, 0);
- assert(fd >= 0);
+ assert_se(fd >= 0);
assert_se(connect(fd, &sa->sa, sizeof(sa->in)) == 0);
_cleanup_close_ int sfd = -1, cfd = -1;
r = getnameinfo_pretty(STDIN_FILENO, &stdin_name);
- log_info("No connection remote: %s", strerror(-r));
+ log_info_errno(r, "No connection remote: %m");
assert_se(r < 0);
sfd = socket(AF_INET, SOCK_STREAM|SOCK_CLOEXEC, 0);
- assert(sfd >= 0);
+ assert_se(sfd >= 0);
assert_se(bind(sfd, &s.sa, sizeof(s.in)) == 0);
log_debug("Accepting new connection on fd:%d", sfd);
cfd = accept4(sfd, &c.sa, &clen, SOCK_CLOEXEC);
- assert(cfd >= 0);
+ assert_se(cfd >= 0);
r = getnameinfo_pretty(cfd, &localhost);
log_info("Connection from %s", localhost);
- assert(r == 0);
+ assert_se(r == 0);
}
static void test_sockaddr_equal(void) {