* gss-misc.c: Include sys/time.h or time.h, to get struct timeval declaration
authorKen Raeburn <raeburn@mit.edu>
Sat, 31 Jan 2004 23:32:18 +0000 (23:32 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 31 Jan 2004 23:32:18 +0000 (23:32 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15992 dc483132-0cff-0310-8789-dd5450dbe970

src/appl/gss-sample/ChangeLog
src/appl/gss-sample/gss-misc.c

index 4a8319b80603d6254b00473809eb909791c8b429..00634076308d9c12c4f868b178ba6632dba608a4 100644 (file)
@@ -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
index c1778132eac5e06c46c22d9ab196d54c5cbfb493..99cb7b50083c37ad238fa4f561a1175e7c45bab3 100644 (file)
@@ -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);
 }
 
 /*