> >I've got a couple of issues related to using courier with AFS home
> >directories.
> >
> >First, to work at all, maildrop needs to be patched. This is based off
> >what courier does if delivering mail directly. The attached patch is for
> >courier-0.42, which is what I've tested with.
> 
> There wasn't anything attached.
> 

I'm stupid. Let's try again.


-- 
--------------------------------------------------------------------------
Troy Benjegerdes                'da hozer'                [EMAIL PROTECTED]   

Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

"Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life." -- Charles Shultz
diff -ur courier-orig/courier-0.42.2/maildrop/maildir.C 
courier-0.42.2/maildrop/maildir.C
--- courier-orig/courier-0.42.2/maildrop/maildir.C      Sun Jan 19 12:07:29 2003
+++ courier-0.42.2/maildrop/maildir.C   Tue Sep 23 20:51:15 2003
@@ -31,7 +31,7 @@
 #include "../maildir/maildirquota.h"
 extern int quota_warn_percent;
 
-Maildir::Maildir() : is_open(0)
+Maildir::Maildir() : is_open(0) , is_afs(0)
 {
 }
 
@@ -181,8 +181,17 @@
                Buffer dir;
 
                if (link( (const char *)tmpname, (const char *)newname) < 0)
-                       throw "link() failed.";
-
+               {
+                       if (errno == EXDEV){
+                               if(rename((const char *)tmpname, (const char 
*)newname) < 0)
+                                       throw "rename() failed.";
+                               is_afs = 1;
+                       }
+                       else
+                       {
+                               throw "link() failed.";
+                       }
+               }
                dir=newname;
                const char *p=dir;
                const char *q=strrchr(p, '/');
@@ -212,5 +221,5 @@
 
 void   Maildir::MaildirAbort()
 {
-       if (is_open)    unlink( (const char *)tmpname );
+       if (is_open && !is_afs) unlink( (const char *)tmpname );
 }
diff -ur courier-orig/courier-0.42.2/maildrop/maildir.h 
courier-0.42.2/maildrop/maildir.h
--- courier-orig/courier-0.42.2/maildrop/maildir.h      Mon Aug  2 00:02:26 1999
+++ courier-0.42.2/maildrop/maildir.h   Tue Sep 23 20:51:15 2003
@@ -16,6 +16,7 @@
 
 class Maildir {
        int     is_open;
+       int     is_afs;
 public:
        Buffer  tmpname;
        Buffer  newname;

Reply via email to