Back to index

courier  0.68.2
Classes | Defines | Functions
maildircreate.h File Reference
#include <stdio.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  maildir_tmpcreate_info

Defines

#define maildir_tmpcreate_init(i)

Functions

int maildir_tmpcreate_fd (struct maildir_tmpcreate_info *)
FILE * maildir_tmpcreate_fp (struct maildir_tmpcreate_info *)
void maildir_tmpcreate_free (struct maildir_tmpcreate_info *)
int maildir_movetmpnew (const char *tmpname, const char *newname)

Class Documentation

struct maildir_tmpcreate_info

Definition at line 22 of file maildircreate.h.

Class Members
int doordie
const char * hostname
const char * maildir
unsigned long msgsize
char * newname
int openmode
char * tmpname
const char * uniq

Define Documentation

#define maildir_tmpcreate_init (   i)
Value:
do \
       { \
              memset( (i), 0, sizeof(*(i))); \
              (i)->openmode=0644; \
       } while(0)

Definition at line 33 of file maildircreate.h.


Function Documentation

int maildir_movetmpnew ( const char *  tmpname,
const char *  newname 
)

Definition at line 226 of file maildircreate.c.

{
       if (link(tmpname, newname) == 0)
       {
              unlink(tmpname);
              return 0;
       }

       if (errno != EXDEV)
              return -1;

       /* AFS? */

       return rename(tmpname, newname);
}

Here is the caller graph for this function:

Definition at line 63 of file maildircreate.c.

{
       int i;

       if (!info->doordie)
              return (maildir_tmpcreate_fd_do(info));

       for (i=0; i<KEEPTRYING / SLEEPFOR; i++)
       {
              int fd=maildir_tmpcreate_fd_do(info);

              if (fd >= 0 || errno != EAGAIN)
                     return fd;

              sleep(SLEEPFOR);
       }

       return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 39 of file maildircreate.c.

{
       int fd=maildir_tmpcreate_fd(info);
       FILE *fp;

       if (fd < 0)
              return NULL;

       fp=fdopen(fd, "w+");

       if (fp == NULL)
       {
              close(fd);
              return NULL;
       }

       return fp;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 215 of file maildircreate.c.

{
       if (info->tmpname)
              free(info->tmpname);
       info->tmpname=NULL;

       if (info->newname)
              free(info->newname);
       info->newname=NULL;
}

Here is the caller graph for this function: