summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-01-31 23:32:18 +0000
committerKen Raeburn <raeburn@mit.edu>2004-01-31 23:32:18 +0000
commit10454c23a28f9f7c549346dc5e5024f763f65897 (patch)
treecedd2cd5ec35c32c7e8e92e6630193d04960a960
parent281b772a8cf77803294b90297a8f785004259d91 (diff)
downloadkrb5-10454c23a28f9f7c549346dc5e5024f763f65897.tar.gz
krb5-10454c23a28f9f7c549346dc5e5024f763f65897.tar.xz
krb5-10454c23a28f9f7c549346dc5e5024f763f65897.zip
* 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
-rw-r--r--src/appl/gss-sample/ChangeLog5
-rw-r--r--src/appl/gss-sample/gss-misc.c35
2 files changed, 26 insertions, 14 deletions
diff --git a/src/appl/gss-sample/ChangeLog b/src/appl/gss-sample/ChangeLog
index 4a8319b806..0063407630 100644
--- a/src/appl/gss-sample/ChangeLog
+++ b/src/appl/gss-sample/ChangeLog
@@ -1,3 +1,8 @@
+2004-01-31 Ken Raeburn <raeburn@mit.edu>
+
+ * gss-misc.c: Include sys/time.h or time.h, to get struct timeval
+ declaration.
+
2004-01-30 Jeffrey Altman <jaltman@mit.edu>
* 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 c1778132ea..99cb7b5008 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 <string.h>
+/* need struct timeval */
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
#include <gssapi/gssapi_generic.h>
#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);
}
/*