*** vdelivermail.c.old  Thu Mar  8 16:57:56 2001
--- vdelivermail.c      Thu Mar  8 16:55:26 2001
***************
*** 573,591 ****
        if ( hit_filter == 1 ) {
                do_filter_delivery( tmp_file );
        } else {
!               if (link(tmp_file,mailname) == -1) {
                        delete_tmp();
                        failtemp("Unable to link tmp to new (#4.3.7)\n");
                }
        }
  #else
!       if (link(tmp_file_f,mailname) == -1) {
                delete_tmp_f();
                failtemp("Unable to link tmp to new (#4.3.7)\n");
        }
  #endif
  
!       delete_tmp_f();
  }
  
  
--- 573,595 ----
        if ( hit_filter == 1 ) {
                do_filter_delivery( tmp_file );
        } else {
! 
! /* Using rename() instead of link() due to Codafs. */
!               if (rename(tmp_file,mailname) == -1) { 
                        delete_tmp();
                        failtemp("Unable to link tmp to new (#4.3.7)\n");
                }
        }
  #else
!       if (rename(tmp_file_f,mailname) == -1) {
                delete_tmp_f();
                failtemp("Unable to link tmp to new (#4.3.7)\n");
        }
  #endif
  
! /* We don't need delete_tmp_f anymore, because rename() "deletes" file in tmp/ dir.
!       delete_tmp_f(); 
! */
  }
  
  
***************
*** 783,793 ****
                delete_tmp();
                failtemp("Unable to close() tmp file (#4.3.6)\n");
        }
!       if (link(tmp_file,mailname) == -1) {
                delete_tmp();
                failtemp("Unable to link tmp to new (#4.3.7)\n");
        }
!       delete_tmp();
  
  #ifdef HARD_QUOTA
        if ( pw_data != NULL && sstrncmp(pw_data->pw_shell, "NO",2)!=0 &&
--- 787,797 ----
                delete_tmp();
                failtemp("Unable to close() tmp file (#4.3.6)\n");
        }
!       if (rename(tmp_file,mailname) == -1) {
                delete_tmp();
                failtemp("Unable to link tmp to new (#4.3.7)\n");
        }
! /*    delete_tmp(); */
  
  #ifdef HARD_QUOTA
        if ( pw_data != NULL && sstrncmp(pw_data->pw_shell, "NO",2)!=0 &&
