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
+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.
krb5_flags flags;
char stdio_buffer[BUFSIZ];
int version;
+ int mode;
} krb5_scc_data;
/* An off_t can be arbitrarily complex */
(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;
#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