summaryrefslogtreecommitdiffabout
path: root/libetpan/src/low-level/maildir/maildir.c
Unidiff
Diffstat (limited to 'libetpan/src/low-level/maildir/maildir.c') (more/less context) (ignore whitespace changes)
-rw-r--r--libetpan/src/low-level/maildir/maildir.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/libetpan/src/low-level/maildir/maildir.c b/libetpan/src/low-level/maildir/maildir.c
index 98b9f87..e81625d 100644
--- a/libetpan/src/low-level/maildir/maildir.c
+++ b/libetpan/src/low-level/maildir/maildir.c
@@ -111,4 +111,6 @@ static char * maildir_get_new_message_filename(struct maildir * md,
111 int k; 111 int k;
112 time_t now; 112 time_t now;
113 //LR
114 struct stat f_stat;
113 int got_file; 115 int got_file;
114 int r; 116 int r;
@@ -122,5 +124,16 @@ static char * maildir_get_new_message_filename(struct maildir * md,
122 snprintf(filename, sizeof(filename), "%s/tmp/%s", 124 snprintf(filename, sizeof(filename), "%s/tmp/%s",
123 md->mdir_path, basename); 125 md->mdir_path, basename);
124 126
127 // LR changed following lines
128 if ( stat( filename, &f_stat ) == -1 ) {
129 char * dup_filename;
130
131 dup_filename = strdup(filename);
132 if (dup_filename == NULL) {
133 //unlink(filename);
134 return NULL;
135 }
136 rename (tmpfile,dup_filename );
137#if 0
125 if (link(tmpfile, filename) == 0) { 138 if (link(tmpfile, filename) == 0) {
126 got_file = 1; 139 got_file = 1;
@@ -148,5 +161,5 @@ static char * maildir_get_new_message_filename(struct maildir * md,
148 return NULL; 161 return NULL;
149 } 162 }
150 163#endif
151 md->mdir_counter ++; 164 md->mdir_counter ++;
152 165