diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-17 10:38:46 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-17 10:38:46 +0100 |
commit | 0957820a1076d7fcf182ba60c12e5946c193545f (patch) | |
tree | 2339489d05441895d1b221cab59fae36816c33eb /gss-misc.c | |
parent | c9841fbd368e58674cc166e6186b2a29f9895211 (diff) | |
parent | 9e28d47aaa506709a9e80e318527ceb4443cbffe (diff) | |
download | rsyslog-0957820a1076d7fcf182ba60c12e5946c193545f.tar.gz rsyslog-0957820a1076d7fcf182ba60c12e5946c193545f.tar.xz rsyslog-0957820a1076d7fcf182ba60c12e5946c193545f.zip |
Merge branch 'v4-devel'
Conflicts:
doc/rsyslog_conf_modules.html
gss-misc.c
plugins/imgssapi/imgssapi.c
plugins/imudp/imudp.c
plugins/imuxsock/imuxsock.c
runtime/glbl.c
runtime/glbl.h
runtime/net.c
Diffstat (limited to 'gss-misc.c')
-rw-r--r-- | gss-misc.c | 25 |
1 files changed, 20 insertions, 5 deletions
@@ -52,11 +52,14 @@ #include "errmsg.h" #include "gss-misc.h" #include "debug.h" +#include "glbl.h" +#include "unlimited_select.h" MODULE_TYPE_LIB /* static data */ DEFobjStaticHelpers +DEFobjCurrIf(glbl) DEFobjCurrIf(errmsg) static void display_status_(char *m, OM_uint32 code, int type) @@ -109,28 +112,38 @@ static int read_all(int fd, char *buf, unsigned int nbyte) { int ret; char *ptr; - fd_set rfds; struct timeval tv; +#ifdef USE_UNLIMITED_SELECT + fd_set *pRfds = malloc(glbl.GetFdSetSize()); +#else + fd_set rfds; + fd_set *pRfds = &rfds; +#endif for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) { - FD_ZERO(&rfds); - FD_SET(fd, &rfds); + FD_ZERO(pRfds); + FD_SET(fd, pRfds); tv.tv_sec = 1; tv.tv_usec = 0; - if ((ret = select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) <= 0 - || !FD_ISSET(fd, &rfds)) + if ((ret = select(FD_SETSIZE, pRfds, NULL, NULL, &tv)) <= 0 + || !FD_ISSET(fd, pRfds)) { + freeFdSet(pRfds); return ret; + } ret = recv(fd, ptr, nbyte, 0); if (ret < 0) { if (errno == EINTR) continue; + freeFdSet(pRfds); return (ret); } else if (ret == 0) { + freeFdSet(pRfds); return (ptr - buf); } } + freeFdSet(pRfds); return (ptr - buf); } @@ -265,6 +278,7 @@ BEGINObjClassExit(gssutil, OBJ_IS_LOADABLE_MODULE) /* CHANGE class also in END M CODESTARTObjClassExit(gssutil) /* release objects we no longer need */ objRelease(errmsg, CORE_COMPONENT); + objRelease(glbl, CORE_COMPONENT); ENDObjClassExit(gssutil) @@ -275,6 +289,7 @@ ENDObjClassExit(gssutil) BEGINAbstractObjClassInit(gssutil, 1, OBJ_IS_LOADABLE_MODULE) /* class, version - CHANGE class also in END MACRO! */ /* request objects we use */ CHKiRet(objUse(errmsg, CORE_COMPONENT)); + CHKiRet(objUse(glbl, CORE_COMPONENT)); ENDObjClassInit(gssutil) |