diff options
| author | Tom Yu <tlyu@mit.edu> | 2000-10-31 00:33:00 +0000 |
|---|---|---|
| committer | Tom Yu <tlyu@mit.edu> | 2000-10-31 00:33:00 +0000 |
| commit | e4521e79d7069fabfea3144da74973add29b3569 (patch) | |
| tree | 7b0ee797b22df19a042013f137210bd81c786820 /src | |
| parent | af8e4edb0dd1df3bdb0306575f93b7378c661930 (diff) | |
| download | krb5-e4521e79d7069fabfea3144da74973add29b3569.tar.gz krb5-e4521e79d7069fabfea3144da74973add29b3569.tar.xz krb5-e4521e79d7069fabfea3144da74973add29b3569.zip | |
* cc_stdio.c: Add a "mode" field to krb5_scc_data to keep track of
what mode the file was opened in.
(krb5_scc_close_file): Ignore EBADF from fflush() if the file was
opened for readonly access. For some reason NetBSD's fflush()
exhibits this behavior.
(krb5_scc_open_file): Save the mode with which the file was opened
in data->mode.
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12825 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/krb5/ccache/ChangeLog | 10 | ||||
| -rw-r--r-- | src/lib/krb5/ccache/cc_stdio.c | 8 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index 8c2724ad6..75abaa032 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,13 @@ +2000-10-30 Tom Yu <tlyu@mit.edu> + + * cc_stdio.c: Add a "mode" field to krb5_scc_data to keep track of + what mode the file was opened in. + (krb5_scc_close_file): Ignore EBADF from fflush() if the file was + opened for readonly access. For some reason NetBSD's fflush() + exhibits this behavior. + (krb5_scc_open_file): Save the mode with which the file was opened + in data->mode. + 2000-10-17 Ezra Peisach <epeisach@mit.edu> * cc_stdio.c, cc_file.c: Unsigned/signed int cleanup. diff --git a/src/lib/krb5/ccache/cc_stdio.c b/src/lib/krb5/ccache/cc_stdio.c index f7ea17b29..f46e5d649 100644 --- a/src/lib/krb5/ccache/cc_stdio.c +++ b/src/lib/krb5/ccache/cc_stdio.c @@ -316,6 +316,7 @@ typedef struct _krb5_scc_data { krb5_flags flags; char stdio_buffer[BUFSIZ]; int version; + int mode; } krb5_scc_data; /* An off_t can be arbitrarily complex */ @@ -1173,6 +1174,12 @@ krb5_scc_close_file (context, id) (failed) syscall */ if (ret == EOF && !errno) ret = 0; #endif + /* + * NetBSD returns EBADF on fflush of a read-only file. + */ + if (ret == EOF && errno == EBADF + && data->mode == SCC_OPEN_RDONLY) + ret = 0; memset (data->stdio_buffer, 0, sizeof (data->stdio_buffer)); if (ret == EOF) { int errsave = errno; @@ -1253,6 +1260,7 @@ krb5_scc_open_file (context, id, mode) #endif if (!f) return krb5_scc_interpret (context, errno); + data->mode = mode; #ifdef HAVE_SETVBUF setvbuf(f, data->stdio_buffer, _IOFBF, sizeof (data->stdio_buffer)); #else |
