diff --git a/lib/krb5/fcache.c b/lib/krb5/fcache.c index 11a2808a1..cb78ae50d 100644 --- a/lib/krb5/fcache.c +++ b/lib/krb5/fcache.c @@ -202,6 +202,10 @@ erase_file(const char *filename) else return errno; } + if (unlink(filename) < 0) { + close (fd); + return errno; + } ret = fstat (fd, &sb2); if (ret < 0) { close (fd); @@ -215,17 +219,6 @@ erase_file(const char *filename) return EPERM; } - if (unlink(filename) < 0) { - close (fd); - return errno; - } - - ret = fstat (fd, &sb2); - if (ret < 0) { - close (fd); - return errno; - } - /* there are still hard links to this file */ if (sb2.st_nlink != 0) {