*** vmailmgr-0.97/commands/vdeliver.cc.orig 2007-03-23 10:20:22.000000000 -0400 --- vmailmgr-0.97/commands/vdeliver.cc 2006-12-01 16:35:05.000000000 -0500 *************** *** 28,33 **** --- 28,35 ---- #include "misc/itoa.h" #include "misc/stat_fns.h" #include "misc/exec.h" + #include + #include const char* cli_program = "vdeliver"; const char* cli_help_prefix = "VMailMgr delivery agent\n"; *************** *** 175,182 **** const mystring hostname = make_hostname(); pid_t pid = getpid(); for(;; sleep(2)) { ! partname = "/" + mystring(itoa(time(0))) + "." + itoa(pid) + "." + hostname; mystring newfile = newdir + partname; --- 177,188 ---- const mystring hostname = make_hostname(); pid_t pid = getpid(); + + struct timeb the_time; + ftime (&the_time); + for(;; sleep(2)) { ! partname = "/" + mystring(itoa(time(0))) + "." + mystring(itoa(the_time.millitm)) + "." + itoa(pid) + "." + hostname; mystring newfile = newdir + partname; *************** *** 207,224 **** void deliver_fail(const char* msg) { ! mystring tmpfile = maildir + "/tmp/" + partname; unlink(tmpfile.c_str()); die_temp(msg); } void deliver_final() { ! mystring tmpfile = maildir + "/tmp/" + partname; ! mystring newfile = maildir + "/new/" + partname; ! if(link(tmpfile.c_str(), newfile.c_str())) ! deliver_fail("Error linking the temp file to the new file."); if(unlink(tmpfile.c_str())) deliver_fail("Error unlinking the temp file."); } --- 213,234 ---- void deliver_fail(const char* msg) { ! mystring tmpfile = maildir + "/tmp" + partname; unlink(tmpfile.c_str()); die_temp(msg); } void deliver_final() { ! char errstring[256]; ! int errcode; ! mystring tmpfile = maildir + "/tmp" + partname; ! mystring newfile = maildir + "/new" + partname; ! if(errcode = (link(tmpfile.c_str(), newfile.c_str())) ) { ! sprintf(errstring, "Error linking the temp file %s to the new %s file - %d errno: %d", tmpfile.c_str(), newfile.c_str(), errcode, errno); ! deliver_fail(errstring); ! } if(unlink(tmpfile.c_str())) deliver_fail("Error unlinking the temp file."); }