diff src/readpst.c @ 290:fec37c150982

possible fix for corrupted output forking for separate messages
author Carl Byington <carl@five-ten-sg.com>
date Sat, 04 Jun 2011 10:52:47 -0700
parents cc8ee701f190
children bc23fba0da8e
line wrap: on
line diff
--- a/src/readpst.c	Fri May 27 11:36:49 2011 -0700
+++ b/src/readpst.c	Sat Jun 04 10:52:47 2011 -0700
@@ -330,8 +330,9 @@
                     DEBUG_INFO(("I have an email type %"PRIi32", but the folder type %"PRIi32" isn't an email folder. Skipping it\n", item->type, ff.type));
                 }
                 else {
+                    char *extra_mime_headers = NULL;
                     ff.item_count++;
-                    char *extra_mime_headers = NULL;
+                    if (mode == MODE_SEPARATE) mk_separate_file(&ff, (mode_EX) ? ".eml" : "");
                     if (mode == MODE_SEPARATE) {
                         // process this single email message, possibly forking
                         pid_t parent = getpid();
@@ -339,7 +340,6 @@
                         if (child == 0) {
                             // we are the child process, or the original parent if no children were available
                             pid_t me = getpid();
-                            mk_separate_file(&ff, (mode_EX) ? ".eml" : "");
                             write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers);
 #ifdef HAVE_FORK
 #ifdef HAVE_SEMAPHORE_H