Back to index

courier  0.68.2
deliverdotlock.h
Go to the documentation of this file.
00001 #ifndef       deliverdotlock_h
00002 #define       deliverdotlock_h
00003 
00004 
00006 //
00007 // When delivering to a mailbox, and there's an exception, the mailbox
00008 // must be truncated BEFORE the dot lock is released.  Override the cleanup()
00009 // virtual function to do the truncation first.
00010 //
00012 
00013 #include      "config.h"
00014 #include      "dotlock.h"
00015 #include      <sys/types.h>
00016 #include      <sys/stat.h>
00017 
00018 class DeliverDotLock : public DotLock {
00019 
00020        void   cleanup();
00021 
00022        int    truncate_fd;
00023        off_t  truncate_size;
00024 public:
00025        DeliverDotLock();
00026        ~DeliverDotLock();
00027 
00028        void   trap_truncate(int f, off_t size)
00029               {
00030                      truncate_size=size;
00031                      truncate_fd=f;
00032               }
00033        void   remove_trap() { truncate_fd= -1; }
00034        void   truncate();
00035 } ;
00036 #endif