From a27f0d9b94b1fa2a1bc91c969483cc007de1be5f Mon Sep 17 00:00:00 2001 From: Mark Koennecke Date: Fri, 6 Jun 2014 16:38:14 +0200 Subject: [PATCH] - Cosmetic changes to sicsget and counter - Fixed a bug when NETconnect would come back with errno EINPROGRESS which is no error really --- counter.c | 2 +- network.c | 4 ++-- sicsget.c | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/counter.c b/counter.c index 38593a4e..977f2239 100644 --- a/counter.c +++ b/counter.c @@ -265,7 +265,7 @@ static int CheckCountStatus(void *pData, SConnection * pCon) int eCt; char pError[80], pBueffel[132]; int iErr; - float fControl, rate; + float fControl = .0, rate; MonEvent sMon; self = (pCounter) pData; diff --git a/network.c b/network.c index 3fcc6a66..52edc8fa 100644 --- a/network.c +++ b/network.c @@ -287,9 +287,9 @@ mkChannel *NETConnectWithFlags(char *name, int port, int flags) iRet = connect(pRes->sockid, (struct sockaddr *) &(pRes->adresse), sizeof(struct sockaddr_in)); - if (iRet < 0) { - close(pRes->sockid); + if (iRet < 0 && errno ) { if (errno != EINPROGRESS) { + close(pRes->sockid); free(pRes); return NULL; } diff --git a/sicsget.c b/sicsget.c index 69e6dbd0..bcb20a37 100644 --- a/sicsget.c +++ b/sicsget.c @@ -280,8 +280,12 @@ static void configureSICSPipe() static int FindTclVar(void *ms, void *userData) { pParseMessage self = (pParseMessage)ms; + char *pPtr = NULL; - self->response = Tcl_GetVar(InterpGetTcl(pServ->pSics),self->command, TCL_GLOBAL_ONLY); + pPtr = Tcl_GetVar(InterpGetTcl(pServ->pSics),self->command, TCL_GLOBAL_ONLY); + if(pPtr != NULL){ + self->response = strdup(pPtr); + } if(self->response == NULL){ return MPSTOP; }