From: Ken Raeburn Date: Sat, 31 Jan 2004 23:32:18 +0000 (+0000) Subject: * gss-misc.c: Include sys/time.h or time.h, to get struct timeval declaration X-Git-Tag: krb5-1.4-beta1~654 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=10454c23a28f9f7c549346dc5e5024f763f65897;p=krb5.git * gss-misc.c: Include sys/time.h or time.h, to get struct timeval declaration git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15992 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/appl/gss-sample/ChangeLog b/src/appl/gss-sample/ChangeLog index 4a8319b80..006340763 100644 --- a/src/appl/gss-sample/ChangeLog +++ b/src/appl/gss-sample/ChangeLog @@ -1,3 +1,8 @@ +2004-01-31 Ken Raeburn + + * gss-misc.c: Include sys/time.h or time.h, to get struct timeval + declaration. + 2004-01-30 Jeffrey Altman * gss-misc.c (read_all): Add call to select() so we don't block forever diff --git a/src/appl/gss-sample/gss-misc.c b/src/appl/gss-sample/gss-misc.c index c1778132e..99cb7b500 100644 --- a/src/appl/gss-sample/gss-misc.c +++ b/src/appl/gss-sample/gss-misc.c @@ -39,6 +39,13 @@ static char *rcsid = "$Header$"; #endif #include +/* need struct timeval */ +#ifdef HAVE_SYS_TIME_H +#include +#else +#include +#endif + #include #include "gss-misc.h" @@ -87,21 +94,21 @@ static int read_all(int fildes, char *buf, unsigned int nbyte) tv.tv_sec = 10; tv.tv_usec = 0; + for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) { + if (select(FD_SETSIZE, &rfds, NULL, NULL, &tv) <= 0 + || !FD_ISSET(fildes, &rfds)) + return(ptr-buf); + ret = recv(fildes, ptr, nbyte, 0); + if (ret < 0) { + if (errno == EINTR) + continue; + return(ret); + } else if (ret == 0) { + return(ptr-buf); + } + } - for (ptr = buf; nbyte; ptr += ret, nbyte -= ret) { - if ( select(FD_SETSIZE, &rfds, NULL, NULL, &tv) <= 0 || !FD_ISSET(fildes, &rfds) ) - return(ptr-buf); - ret = recv(fildes, ptr, nbyte, 0); - if (ret < 0) { - if (errno == EINTR) - continue; - return(ret); - } else if (ret == 0) { - return(ptr-buf); - } - } - - return(ptr-buf); + return(ptr-buf); } /*