[28021] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Clean up stash file error handling

daemon@ATHENA.MIT.EDU (Benjamin Kaduk)
Mon Nov 4 14:22:36 2013

Date: Mon, 4 Nov 2013 14:22:21 -0500
From: Benjamin Kaduk <kaduk@mit.edu>
Message-Id: <201311041922.rA4JMLjg011810@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/f7e434aa7ecb05a6ade5e3d4a435d25069acd5b2
commit f7e434aa7ecb05a6ade5e3d4a435d25069acd5b2
Author: Ben Kaduk <kaduk@mit.edu>
Date:   Wed Jul 18 10:05:33 2012 -0400

    Clean up stash file error handling
    
    The comment previously failed to match the behavior. The intent was
    that if we failed to write out the entire stash file into the
    temporary location, we should remove the partial file.  However, the
    code was actually checking whether the *real* stash file existed,
    not whether the temporary one existed.
    
    It is safe to always try to unlink the partial file, and not worry
    about whether it already exists.

 src/lib/kdb/kdb_default.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/lib/kdb/kdb_default.c b/src/lib/kdb/kdb_default.c
index 9a7f757..82fa5c4 100644
--- a/src/lib/kdb/kdb_default.c
+++ b/src/lib/kdb/kdb_default.c
@@ -212,9 +212,8 @@ krb5_def_store_mkey_list(krb5_context       context,
     krb5_kt_close(context, kt);
 
     if (retval != 0) {
-        /* delete tmp keyfile if it exists and an error occurrs */
-        if (stat(keyfile, &stb) >= 0)
-            (void) unlink(tmp_ktpath);
+        /* Clean up by deleting the tmp keyfile if it exists. */
+        (void)unlink(tmp_ktpath);
     } else {
         /* rename original keyfile to original filename */
         if (rename(tmp_ktpath, keyfile) < 0) {
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post