.sin6_scope_id = 0,
};
if (bind(sockfd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
- close(sockfd);
+ TEMP_FAILURE_RETRY(close(sockfd));
PLOG_E("bind(host:[%s], port:%d)", bindhost, port);
return -1;
}
if (listen(sockfd, SOMAXCONN) == -1) {
- close(sockfd);
+ TEMP_FAILURE_RETRY(close(sockfd));
PLOG_E("listen(%d)", SOMAXCONN);
return -1;
}
{
struct sockaddr_in6 cli_addr;
socklen_t socklen = sizeof(cli_addr);
- int connfd = accept(listenfd, (struct sockaddr *)&cli_addr, &socklen);
+ int connfd = TEMP_FAILURE_RETRY(accept(listenfd, (struct sockaddr *)&cli_addr, &socklen));
if (connfd == -1) {
if (errno != EINTR) {
PLOG_E("accept(%d)", listenfd);
return false;
}
defer {
- close(sock);
+ TEMP_FAILURE_RETRY(close(sock));
};
struct ifreq ifr;
return false;
}
defer {
- close(sock);
+ TEMP_FAILURE_RETRY(close(sock));
};
if (inet_pton(AF_INET, nsjconf->iface_vs_ip, &addr) != 1) {
if (p->pid == pid) {
LOG_D("Removing pid '%d' from the queue (IP:'%s', start time:'%u')", p->pid,
p->remote_txt, (unsigned int)p->start);
- close(p->pid_syscall_fd);
+ TEMP_FAILURE_RETRY(close(p->pid_syscall_fd));
TAILQ_REMOVE(&nsjconf->pids, p, pointers);
free(p);
return;
pid_t pid = syscall(__NR_clone, (uintptr_t) flags, NULL, NULL, NULL, (uintptr_t) 0);
if (pid == 0) {
- close(sv[1]);
+ TEMP_FAILURE_RETRY(close(sv[1]));
subprocNewProc(nsjconf, fd_in, fd_out, fd_err, sv[0]);
}
defer {
- close(sv[1]);
+ TEMP_FAILURE_RETRY(close(sv[1]));
}
- close(sv[0]);
+ TEMP_FAILURE_RETRY(close(sv[0]));
if (pid == -1) {
PLOG_E("clone(flags=%#lx) failed. You probably need root privileges if your system "
"doesn't support CLONE_NEWUSER. Alternatively, you might want to recompile your "