From c88eb74ea4ed1a7abed76493d786fbf0f6acb6c7 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Mon, 21 Jul 2008 16:07:46 +0000 Subject: [PATCH] pull up r20536 from trunk r20536@cathode-dark-space: tlyu | 2008-07-17 19:40:32 -0400 ticket: 6018 target_version: 1.6.4 tags: pullup In krb5_rc_io_creat(), unlink any existing rcache file before trying to create a new rcache. This allows better recovery from corrupt rcache files. ticket: 6018 status: resolved version_fixed: 1.6.4 git-svn-id: svn://anonsvn.mit.edu/krb5/branches/krb5-1-6@20547 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/rcache/rc_io.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index adc6a8c49..98445caa9 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -83,6 +83,7 @@ krb5_rc_io_creat(krb5_context context, krb5_rc_iostuff *d, char **fn) (void) strcpy(d->fn, dir); (void) strcat(d->fn, PATH_SEPARATOR); (void) strcat(d->fn, *fn); + unlink(d->fn); d->fd = THREEPARAMOPEN(d->fn, O_WRONLY | O_CREAT | O_TRUNC | O_EXCL | O_BINARY, 0600); } @@ -425,7 +426,7 @@ krb5_rc_io_read(krb5_context context, krb5_rc_iostuff *d, krb5_pointer buf, strerror(errno)); return KRB5_RC_IO_UNKNOWN; } - if (count == 0) + if (count != num) return KRB5_RC_IO_EOF; return 0; } -- 2.26.2