From: Tom Yu Date: Thu, 17 Jul 2008 23:40:32 +0000 (+0000) Subject: In krb5_rc_io_creat(), unlink any existing rcache file before trying X-Git-Tag: krb5-1.7-alpha1~587 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d615494f776d692c84f246aaf458096e98fdc952;p=krb5.git 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 target_version: 1.6.4 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20536 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/rcache/rc_io.c b/src/lib/krb5/rcache/rc_io.c index 94e0e542a..59d15c2fa 100644 --- a/src/lib/krb5/rcache/rc_io.c +++ b/src/lib/krb5/rcache/rc_io.c @@ -82,6 +82,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); } else { @@ -418,7 +419,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; }