From 9b4f3c47e1a69922603022320a43111df24e6257 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 13 May 2008 20:21:12 +0200 Subject: [PATCH] Save connect errno so that we get a correct connect failure reason libratbox r25358 (androsyn) --- libratbox/src/commio.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libratbox/src/commio.c b/libratbox/src/commio.c index 12be960..44932c9 100644 --- a/libratbox/src/commio.c +++ b/libratbox/src/commio.c @@ -21,7 +21,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 * USA * - * $Id: commio.c 25038 2008-01-23 16:03:08Z androsyn $ + * $Id: commio.c 25358 2008-05-13 14:48:46Z androsyn $ */ #include #include @@ -470,6 +470,7 @@ rb_connect_callback(rb_fde_t *F, int status) { CNCB *hdl; void *data; + int errtmp = errno; /* save errno as rb_settimeout clobbers it sometimes */ /* This check is gross..but probably necessary */ if(F == NULL || F->connect == NULL || F->connect->callback == NULL) @@ -479,8 +480,10 @@ rb_connect_callback(rb_fde_t *F, int status) data = F->connect->data; F->connect->callback = NULL; + /* Clear the timeout handler */ rb_settimeout(F, 0, NULL, NULL); + errno = errtmp; /* Call the handler */ hdl(F, status, data); }