comparison 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
comparison
equal deleted inserted replaced
289:cc8ee701f190 290:fec37c150982
328 if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_SCHEDULE) && (ff.type != PST_TYPE_REPORT) && (mode != MODE_SEPARATE)) { 328 if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_SCHEDULE) && (ff.type != PST_TYPE_REPORT) && (mode != MODE_SEPARATE)) {
329 ff.skip_count++; 329 ff.skip_count++;
330 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)); 330 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));
331 } 331 }
332 else { 332 else {
333 char *extra_mime_headers = NULL;
333 ff.item_count++; 334 ff.item_count++;
334 char *extra_mime_headers = NULL; 335 if (mode == MODE_SEPARATE) mk_separate_file(&ff, (mode_EX) ? ".eml" : "");
335 if (mode == MODE_SEPARATE) { 336 if (mode == MODE_SEPARATE) {
336 // process this single email message, possibly forking 337 // process this single email message, possibly forking
337 pid_t parent = getpid(); 338 pid_t parent = getpid();
338 pid_t child = try_fork(item->file_as.str); 339 pid_t child = try_fork(item->file_as.str);
339 if (child == 0) { 340 if (child == 0) {
340 // we are the child process, or the original parent if no children were available 341 // we are the child process, or the original parent if no children were available
341 pid_t me = getpid(); 342 pid_t me = getpid();
342 mk_separate_file(&ff, (mode_EX) ? ".eml" : "");
343 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers); 343 write_normal_email(ff.output, ff.name, item, mode, mode_MH, &pstfile, save_rtf_body, &extra_mime_headers);
344 #ifdef HAVE_FORK 344 #ifdef HAVE_FORK
345 #ifdef HAVE_SEMAPHORE_H 345 #ifdef HAVE_SEMAPHORE_H
346 if (me != parent) { 346 if (me != parent) {
347 // we really were a child, forked for the sole purpose of processing this message 347 // we really were a child, forked for the sole purpose of processing this message