]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Use -errno or WSAGetLastError() as return value from rxi_Sendmsg()
authorAdam Megacz <megacz@hcoop.net>
Sun, 19 Jul 2009 18:00:41 +0000 (11:00 -0700)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 17 Dec 2009 06:38:29 +0000 (22:38 -0800)
This patch causes the pthread and lwp implementations of rxi_Sendmsg()
to use -errno or WSAGetLastError() as the return value if it is
positive.  This is required in order to communicate more meaningful
error conditions to rxi_SendPacket[List], which should "down" a host
immediately when it observes ENETUNREACH.

Jeff Altman <jaltman@openafs.org> supplied the logic for the
AFS_NT40_ENV case; I was not able to test this (I do not own a
Windows license) and took him on his word.

Reviewed-on: http://gerrit.openafs.org/58
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Adam Megacz <megacz@gmail.com>
Tested-by: Adam Megacz <megacz@gmail.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit 119c756d96c4a7f9e01e4ff6bb20156f1abf761b)
Change-Id: I31f97e4cef4b32abb69c783d19b1adfd897889fa
Reviewed-on: http://gerrit.openafs.org/943

src/rx/rx_lwp.c
src/rx/rx_pthread.c

index a77e00c4a5932aaf8208abd958ecced749d5fcb7..36d94207e58e92fa6fe49260f8c9e706942b7f8e 100644 (file)
@@ -463,6 +463,13 @@ rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags)
        {
            (osi_Msg "rx failed to send packet: ");
            perror("rx_sendmsg");
+#ifndef AFS_NT40_ENV
+            if (errno > 0)
+              return -errno;
+#elif
+            if (WSAGetLastError() > 0)
+              return -WSAGetLastError();
+#endif
            return -1;
        }
        while ((err = select(socket + 1, 0, sfds, 0, 0)) != 1) {
index 61a1cc6f42f1e812d1855551656ccd6577a48141..78244bde5905f6edc159977d16af02859e68e089 100644 (file)
@@ -421,6 +421,13 @@ rxi_Sendmsg(osi_socket socket, struct msghdr *msg_p, int flags)
 #endif
        dpf(("rxi_sendmsg failed, error %d\n", errno));
        fflush(stdout);
+#ifndef AFS_NT40_ENV
+        if (errno > 0)
+          return -errno;
+#elif
+            if (WSAGetLastError() > 0)
+              return -WSAGetLastError();
+#endif
        return -1;
     }
     return 0;