From c4b14f1a8f0c749a1f25b42536abfc8db2e17ac1 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Sat, 10 Jun 1995 04:29:38 +0000 Subject: [PATCH] Allow for partial reads while reading the token git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6032 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gss-sample/ChangeLog | 5 +++++ src/appl/gss-sample/gss-misc.c | 20 +++++++++----------- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/appl/gss-sample/ChangeLog b/src/appl/gss-sample/ChangeLog index 6b37c09fe..097a40e2b 100644 --- a/src/appl/gss-sample/ChangeLog +++ b/src/appl/gss-sample/ChangeLog @@ -1,3 +1,8 @@ +Sat Jun 10 00:28:50 1995 Theodore Y. Ts'o + + * gss-misc.c (recv_token): Allow for partial reads while reading + the token. + Fri Jun 9 18:26:50 1995 * configure.in: Remove standardized set of autoconf macros, which diff --git a/src/appl/gss-sample/gss-misc.c b/src/appl/gss-sample/gss-misc.c index f4478aa7b..625c601b5 100644 --- a/src/appl/gss-sample/gss-misc.c +++ b/src/appl/gss-sample/gss-misc.c @@ -114,6 +114,7 @@ int recv_token(s, tok) gss_buffer_t tok; { int ret; + int readsofar; if (display_file == 0) display_file = stderr; @@ -137,17 +138,14 @@ int recv_token(s, tok) return -1; } - ret = read(s, (char *) tok->value, tok->length); - if (ret < 0) { - perror("reading token data"); - free(tok->value); - return -1; - } else if (ret != tok->length) { - fprintf(display_file, - "sending token data: %d of %d bytes written\n", - ret, tok->length); - free(tok->value); - return -1; + while (readsofar < tok->length) { + ret = read(s, (char *) tok->value, tok->length); + readsofar += ret; + if (ret < 0) { + perror("reading token data"); + free(tok->value); + return -1; + } } return 0; -- 2.26.2