diff options
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/common/system_aix.c | 10 | ||||
-rw-r--r-- | ctdb/common/system_freebsd.c | 9 | ||||
-rw-r--r-- | ctdb/common/system_gnu.c | 15 | ||||
-rw-r--r-- | ctdb/common/system_kfreebsd.c | 15 | ||||
-rw-r--r-- | ctdb/common/system_linux.c | 9 |
5 files changed, 43 insertions, 15 deletions
diff --git a/ctdb/common/system_aix.c b/ctdb/common/system_aix.c index 10798a7d42f..e44d1d6a031 100644 --- a/ctdb/common/system_aix.c +++ b/ctdb/common/system_aix.c @@ -118,7 +118,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, struct ip ip; struct tcphdr tcp; } ip4pkt; - + int saved_errno; /* for now, we only handle AF_INET addresses */ if (src->ip.sin_family != AF_INET || dest->ip.sin_family != AF_INET) { @@ -165,9 +165,13 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, ip4pkt.tcp.th_win = htons(1234); ip4pkt.tcp.th_sum = tcp_checksum((uint16_t *)&ip4pkt.tcp, sizeof(ip4pkt.tcp), &ip4pkt.ip); - ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, (struct sockaddr *)dest, sizeof(*dest)); + ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, + (struct sockaddr *)dest, sizeof(*dest)); + saved_errno = errno; + close(s); if (ret != sizeof(ip4pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } diff --git a/ctdb/common/system_freebsd.c b/ctdb/common/system_freebsd.c index ca1300a74ce..e72fbbd28ca 100644 --- a/ctdb/common/system_freebsd.c +++ b/ctdb/common/system_freebsd.c @@ -137,6 +137,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, struct ip6_hdr ip6; struct tcphdr tcp; } ip6pkt; + int saved_errno; switch (src->ip.sin_family) { case AF_INET: @@ -183,9 +184,11 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, (const struct sockaddr *)&dest->ip, sizeof(dest->ip)); + saved_errno = errno; close(s); if (ret != sizeof(ip4pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; @@ -228,11 +231,13 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, (const struct sockaddr *)&dest->ip6, sizeof(dest->ip6)); + saved_errno = errno; tmpdest->ip6.sin6_port = tmpport; close(s); if (ret != sizeof(ip6pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; diff --git a/ctdb/common/system_gnu.c b/ctdb/common/system_gnu.c index 0eed47e4e05..603345d0755 100644 --- a/ctdb/common/system_gnu.c +++ b/ctdb/common/system_gnu.c @@ -136,6 +136,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, struct ip6_hdr ip6; struct tcphdr tcp; } ip6pkt; + int saved_errno; switch (src->ip.sin_family) { case AF_INET: @@ -178,10 +179,13 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, return -1; } - ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip)); + ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, + &dest->ip, sizeof(dest->ip)); + saved_errno = errno; close(s); if (ret != sizeof(ip4pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; @@ -220,12 +224,15 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, tmpport = tmpdest->ip6.sin6_port; tmpdest->ip6.sin6_port = 0; - ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, &dest->ip6, sizeof(dest->ip6)); + ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, + &dest->ip6, sizeof(dest->ip6)); + saved_errno = errno; tmpdest->ip6.sin6_port = tmpport; close(s); if (ret != sizeof(ip6pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; diff --git a/ctdb/common/system_kfreebsd.c b/ctdb/common/system_kfreebsd.c index 87624d69bba..7e33990b615 100644 --- a/ctdb/common/system_kfreebsd.c +++ b/ctdb/common/system_kfreebsd.c @@ -136,6 +136,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, struct ip6_hdr ip6; struct tcphdr tcp; } ip6pkt; + int saved_errno; switch (src->ip.sin_family) { case AF_INET: @@ -178,10 +179,13 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, return -1; } - ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, &dest->ip, sizeof(dest->ip)); + ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, + &dest->ip, sizeof(dest->ip)); + saved_errno = errno; close(s); if (ret != sizeof(ip4pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; @@ -220,12 +224,15 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, tmpport = tmpdest->ip6.sin6_port; tmpdest->ip6.sin6_port = 0; - ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, &dest->ip6, sizeof(dest->ip6)); + ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, + &dest->ip6, sizeof(dest->ip6)); + saved_errno = errno; tmpdest->ip6.sin6_port = tmpport; close(s); if (ret != sizeof(ip6pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; diff --git a/ctdb/common/system_linux.c b/ctdb/common/system_linux.c index a036011faee..3647de9be7c 100644 --- a/ctdb/common/system_linux.c +++ b/ctdb/common/system_linux.c @@ -344,6 +344,7 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, struct ip6_hdr ip6; struct tcphdr tcp; } ip6pkt; + int saved_errno; switch (src->ip.sin_family) { case AF_INET: @@ -389,9 +390,11 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, ret = sendto(s, &ip4pkt, sizeof(ip4pkt), 0, (const struct sockaddr *)&dest->ip, sizeof(dest->ip)); + saved_errno = errno; close(s); if (ret != sizeof(ip4pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; @@ -433,11 +436,13 @@ int ctdb_sys_send_tcp(const ctdb_sock_addr *dest, ret = sendto(s, &ip6pkt, sizeof(ip6pkt), 0, (const struct sockaddr *)&dest->ip6, sizeof(dest->ip6)); + saved_errno = errno; tmpdest->ip6.sin6_port = tmpport; close(s); if (ret != sizeof(ip6pkt)) { - DEBUG(DEBUG_CRIT,(__location__ " failed sendto (%s)\n", strerror(errno))); + DEBUG(DEBUG_ERR, + ("Failed sendto (%s)\n", strerror(saved_errno))); return -1; } break; |