summaryrefslogtreecommitdiff
path: root/src/anet.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/anet.c')
-rw-r--r--src/anet.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/anet.c b/src/anet.c
index 753f2fe42..d4411382c 100644
--- a/src/anet.c
+++ b/src/anet.c
@@ -62,6 +62,15 @@ static void anetSetError(char *err, const char *fmt, ...)
va_end(ap);
}
+int anetGetError(int fd) {
+ int sockerr = 0;
+ socklen_t errlen = sizeof(sockerr);
+
+ if (getsockopt(fd, SOL_SOCKET, SO_ERROR, &sockerr, &errlen) == -1)
+ sockerr = errno;
+ return sockerr;
+}
+
int anetSetBlock(char *err, int fd, int non_block) {
int flags;