diff options
author | varmojfekoj <theinric@redhat.com> | 2009-11-17 09:00:01 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-17 09:00:01 +0100 |
commit | 30c2e42ec305bb97bd04172e5c02b89eeea53e35 (patch) | |
tree | 9a4752ef46da708ff1e6172376851d16a8c68bf8 /gss-misc.c | |
parent | c104eea4e5d0aeb4c87ee23fab8532530d5fe0e9 (diff) | |
download | rsyslog-30c2e42ec305bb97bd04172e5c02b89eeea53e35.tar.gz rsyslog-30c2e42ec305bb97bd04172e5c02b89eeea53e35.tar.bz2 rsyslog-30c2e42ec305bb97bd04172e5c02b89eeea53e35.zip |
added option to use unlimited-size select() calls
Thanks to varmjofekoj for the patch
Signed-off-by: Rainer Gerhards <rgerhards@adiscon.com>
Diffstat (limited to 'gss-misc.c')
-rw-r--r-- | gss-misc.c | 23 |
1 files changed, 18 insertions, 5 deletions
@@ -51,11 +51,14 @@ #include "obj.h" #include "errmsg.h" #include "gss-misc.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) @@ -108,28 +111,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); } |