[krbdev.mit.edu #8020] rename() failure in src/util/profile/prof_file.c:write_data_to_file()

Tsu-Phong Wu via RT rt-comment at krbdev.mit.edu
Thu Sep 25 13:08:22 EDT 2014


Hi,

Like to report a bug with simple fix below:

     unlink(old_file);
     if (make_hard_link(outfile, old_file) == 0) {
         /* Okay, got the hard link.  Yay.  Now we've got our
            backup version, so just put the new version in
            place.  */
         if (rename(new_file, outfile)) {
             /* Weird, the rename didn't work.  But the old version
                should still be in place, so no special cleanup is
                needed.  */
<<<<<
             unlink(old_file); <<<<< In case of rename() failure, 
outfile should be fine.
<<<<< But old_file is extra from above make_hard_link(), and should be 
removed.
             retval = errno;
             goto errout;
         }
     } else if (errno == ENOENT && can_create) {




More information about the krb5-bugs mailing list