2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 13:58:34 +00:00

tcp: Print error reported from sys_setsockopt

We use pr_perror, but after direct syscall calling the
errno is not initialized (and in PIE it doesn't even exists).

Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Pavel Emelyanov
2013-04-11 19:50:08 +04:00
parent 84a0cabbd5
commit 64d039dc29
2 changed files with 11 additions and 8 deletions

View File

@@ -51,10 +51,11 @@ struct rst_tcp_sock {
static inline void tcp_repair_off(int fd)
{
int aux = 0;
int aux = 0, ret;
if (sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to turn off repair mode on socket");
ret = sys_setsockopt(fd, SOL_TCP, TCP_REPAIR, &aux, sizeof(aux));
if (ret < 0)
pr_perror("Failed to turn off repair mode on socket (%d)", ret);
}
void tcp_locked_conn_add(struct inet_sk_info *);

View File

@@ -333,13 +333,15 @@ static u64 restore_mapping(const VmaEntry *vma_entry)
static void rst_tcp_repair_off(struct rst_tcp_sock *rts)
{
int aux;
tcp_repair_off(rts->sk);
int aux, ret;
aux = rts->reuseaddr;
if (sys_setsockopt(rts->sk, SOL_SOCKET, SO_REUSEADDR, &aux, sizeof(aux)) < 0)
pr_perror("Failed to restore of SO_REUSEADDR on socket");
pr_debug("pie: Turning repair off for %d (reuse %d)\n", rts->sk, aux);
tcp_repair_off(rts->sk);
ret = sys_setsockopt(rts->sk, SOL_SOCKET, SO_REUSEADDR, &aux, sizeof(aux));
if (ret < 0)
pr_perror("Failed to restore of SO_REUSEADDR on socket (%d)", ret);
}
static void rst_tcp_socks_all(struct rst_tcp_sock *arr, int size)