author | zautrix <zautrix> | 2004-12-04 04:53:22 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-12-04 04:53:22 (UTC) |
commit | 7828f46413766ee5db72dc9bd457eac0868f0646 (patch) (side-by-side diff) | |
tree | d3da09120bdef2b498f836c5b1b97a5b2aa2da99 /kmicromail/libetpan | |
parent | 967f7c879d06961dd7a25d019380c521f7a84792 (diff) | |
download | kdepimpi-7828f46413766ee5db72dc9bd457eac0868f0646.zip kdepimpi-7828f46413766ee5db72dc9bd457eac0868f0646.tar.gz kdepimpi-7828f46413766ee5db72dc9bd457eac0868f0646.tar.bz2 |
fixed some bugs
-rw-r--r-- | kmicromail/libetpan/maildir/maildir.c | 25 | ||||
-rw-r--r-- | kmicromail/libetpan/mh/mailmh.c | 12 |
2 files changed, 26 insertions, 11 deletions
diff --git a/kmicromail/libetpan/maildir/maildir.c b/kmicromail/libetpan/maildir/maildir.c index 0e038b1..1ef0b7a 100644 --- a/kmicromail/libetpan/maildir/maildir.c +++ b/kmicromail/libetpan/maildir/maildir.c @@ -110,5 +110,7 @@ static char * maildir_get_new_message_filename(struct maildir * md, time_t now; - + struct stat f_stat; now = time(NULL); k = 0; + + fprintf(stderr,"maildir_get_new_message_filename: %s \n", tmpfile); while (k < MAX_TRY_ALLOC) { @@ -118,4 +120,6 @@ static char * maildir_get_new_message_filename(struct maildir * md, md->mdir_path, basename); - - if (link(tmpfile, filename) == 0) { + fprintf(stderr,"filename %s \n", filename); + // LR changed following lines + if ( stat( filename, &f_stat ) == -1 ) { + //if (link(tmpfile, filename) == 0) { char * dup_filename; @@ -124,7 +128,8 @@ static char * maildir_get_new_message_filename(struct maildir * md, if (dup_filename == NULL) { - unlink(filename); + //unlink(filename); return NULL; } - - unlink(tmpfile); + fprintf(stderr,"filename %s %s \n", tmpfile,dup_filename); + //unlink(tmpfile); + rename (tmpfile,dup_filename ); md->mdir_counter ++; @@ -274,2 +279,3 @@ static int add_message(struct maildir * md, + fprintf(stderr,"add_message filename: %s \n", filename); msg = msg_new(filename, is_new); @@ -448,2 +454,3 @@ int maildir_message_add_uid(struct maildir * md, + fprintf(stderr,"maildir_message_add_uid for uid: %s \n", uid); r = maildir_update(md); @@ -560,2 +567,3 @@ int maildir_message_add_file_uid(struct maildir * md, int fd, + fprintf(stderr,"maildir_message_add_file_uid: %s \n", uid); if (fstat(fd, &buf) == -1) @@ -576,2 +584,3 @@ int maildir_message_add_file(struct maildir * md, int fd) { + fprintf(stderr,"maildir_message_add_file \n"); return maildir_message_add_file_uid(md, fd, @@ -590,2 +599,3 @@ char * maildir_message_get(struct maildir * md, const char * uid) + fprintf(stderr,"maildir_message_get for uid: %s \n", uid); key.data = (void *) uid; @@ -622,2 +632,3 @@ int maildir_message_remove(struct maildir * md, const char * uid) + fprintf(stderr,"maildir_message_remove for uid: %s \n", uid); key.data = (void *) uid; @@ -664,3 +675,3 @@ int maildir_message_change_flags(struct maildir * md, int res; - + fprintf(stderr,"maildir_message_change_flags for uid: %s \n", uid); key.data = (void *) uid; diff --git a/kmicromail/libetpan/mh/mailmh.c b/kmicromail/libetpan/mh/mailmh.c index 119f217..5e2b4cc 100644 --- a/kmicromail/libetpan/mh/mailmh.c +++ b/kmicromail/libetpan/mh/mailmh.c @@ -609,2 +609,3 @@ static int mailmh_folder_alloc_msg(struct mailmh_folder * folder, size_t len; + struct stat f_stat; @@ -617,2 +618,3 @@ static int mailmh_folder_alloc_msg(struct mailmh_folder * folder, + //fprintf(stderr,"mailmh_folder_alloc_msg filename: %s \n", filename); k = 0; @@ -621,8 +623,10 @@ static int mailmh_folder_alloc_msg(struct mailmh_folder * folder, MAIL_DIR_SEPARATOR, (unsigned long) (max + k)); - - if (link(filename, new_filename) == 0) { + //fprintf(stderr,"mailmh_folder_alloc_msg new_filename: %s \n", new_filename); + if ( stat( new_filename, &f_stat ) == -1 ) { + // if (link(filename, new_filename) == 0) { int r; - + //fprintf(stderr,"filename found \n"); + //unlink(filename); + rename (filename,new_filename ); free(new_filename); - unlink(filename); |