comparison src/readpst.c @ 289:cc8ee701f190

pst_block_offset elements are unsigned; consistent usage of pst_malloc and pst_realloc
author Carl Byington <carl@five-ten-sg.com>
date Fri, 27 May 2011 11:36:49 -0700
parents fa7fc1ac6385
children fec37c150982
comparison
equal deleted inserted replaced
288:fa7fc1ac6385 289:cc8ee701f190
740 DEBUG_ENT("mk_kmail_dir"); 740 DEBUG_ENT("mk_kmail_dir");
741 if (kmail_chdir && chdir(kmail_chdir)) { 741 if (kmail_chdir && chdir(kmail_chdir)) {
742 x = errno; 742 x = errno;
743 DIE(("mk_kmail_dir: Cannot change to directory %s: %s\n", kmail_chdir, strerror(x))); 743 DIE(("mk_kmail_dir: Cannot change to directory %s: %s\n", kmail_chdir, strerror(x)));
744 } 744 }
745 dir = malloc(strlen(fname)+strlen(OUTPUT_KMAIL_DIR_TEMPLATE)+1); 745 dir = pst_malloc(strlen(fname)+strlen(OUTPUT_KMAIL_DIR_TEMPLATE)+1);
746 sprintf(dir, OUTPUT_KMAIL_DIR_TEMPLATE, fname); 746 sprintf(dir, OUTPUT_KMAIL_DIR_TEMPLATE, fname);
747 check_filename(dir); 747 check_filename(dir);
748 if (D_MKDIR(dir)) { 748 if (D_MKDIR(dir)) {
749 if (errno != EEXIST) { // not an error because it exists 749 if (errno != EEXIST) { // not an error because it exists
750 x = errno; 750 x = errno;
751 DIE(("mk_kmail_dir: Cannot create directory %s: %s\n", dir, strerror(x))); 751 DIE(("mk_kmail_dir: Cannot create directory %s: %s\n", dir, strerror(x)));
752 } 752 }
753 } 753 }
754 kmail_chdir = realloc(kmail_chdir, strlen(dir)+1); 754 kmail_chdir = pst_realloc(kmail_chdir, strlen(dir)+1);
755 strcpy(kmail_chdir, dir); 755 strcpy(kmail_chdir, dir);
756 free (dir); 756 free (dir);
757 757
758 //we should remove any existing indexes created by KMail, cause they might be different now 758 //we should remove any existing indexes created by KMail, cause they might be different now
759 index = malloc(strlen(fname)+strlen(KMAIL_INDEX)+1); 759 index = pst_malloc(strlen(fname)+strlen(KMAIL_INDEX)+1);
760 sprintf(index, KMAIL_INDEX, fname); 760 sprintf(index, KMAIL_INDEX, fname);
761 unlink(index); 761 unlink(index);
762 free(index); 762 free(index);
763 763
764 out_name = malloc(strlen(fname)+strlen(OUTPUT_TEMPLATE)+1); 764 out_name = pst_malloc(strlen(fname)+strlen(OUTPUT_TEMPLATE)+1);
765 sprintf(out_name, OUTPUT_TEMPLATE, fname); 765 sprintf(out_name, OUTPUT_TEMPLATE, fname);
766 DEBUG_RET(); 766 DEBUG_RET();
767 return out_name; 767 return out_name;
768 } 768 }
769 769