Ignore:
Timestamp:
Sep 25, 2013, 9:03:25 AM (11 years ago)
Author:
Bruno Cornec
Message:
  • revert r3188 & r3189 as I started to work on branch 3.0 before deciding it was much better to do it in 3.2. This will allow some small maintenance work on 3.0 if needed, while pushing all the rest to 3.2 and providing early access to it.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/mondo/src/common/libmondo-archive.c

    r3188 r3192  
    6464extern bool g_cd_recovery;
    6565extern char *g_mondo_home;
    66 
    67 /**
    68  * The serial string (used to differentiate between backups) of the current backup.
    69  */
    70 char *g_serial_string = NULL;
    71 
     66/*
     67extern char *g_tmpfs_mountpt;
     68*/
     69extern char *g_serial_string;
    7270extern char *g_getfacl;
    7371extern char *g_getfattr;
     
    202200
    203201    if (!does_file_exist(filelist)) {
    204         log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist);
     202        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
     203        log_to_screen(tmp);
     204        paranoid_free(tmp);
    205205        return (1);
    206206    }
     
    208208    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    209209    if (system(tmp)) {
    210         mr_free(tmp);
     210        paranoid_free(tmp);
    211211        fatal_error("Unable to write tarball to scratchdir");
    212212    }
    213213    paranoid_free(tmp);
    214214
    215     mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s", filelist, fname);
     215    mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s",
     216            filelist, fname);
    216217    if (bkpinfo->use_lzo) {
    217         mr_free(command);
    218218        fatal_error("Can't use lzop");
    219219    }
     
    235235            res = 0;
    236236        }
    237         mr_free(tmp);
     237        paranoid_free(tmp);
    238238
    239239        if (res) {
     
    251251        }
    252252    }
    253     mr_free(command);
     253    paranoid_free(command);
    254254
    255255    retval += res;
     
    307307
    308308    if (!does_file_exist(filelist)) {
    309         log_to_screen("(archive_this_fileset) - filelist %s does not exist", filelist);
     309        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist",
     310                filelist);
     311        log_to_screen(tmp);
     312        paranoid_free(tmp);
    310313        return (1);
    311314    }
    312315    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    313316    if (system(tmp)) {
    314         mr_free(tmp);
     317        paranoid_free(tmp);
    315318        fatal_error("Unable to write tarball to scratchdir");
    316319    }
    317     mr_free(tmp);
     320    paranoid_free(tmp);
    318321
    319322
     
    321324        mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    322325        //       -b %ld, TAPE_BLOCK_SIZE
    323         mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe, bkpinfo->compression_level);
     326        mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
     327                bkpinfo->compression_level);
    324328        if (does_file_exist(tmp)) {
    325329            mr_strcat(zipparams, " -E %s",tmp);
     
    327331            log_msg(3, "%s not found. Cannot exclude zipfiles, etc.", tmp);
    328332        }
    329         mr_free(tmp);
     333        paranoid_free(tmp);
    330334    } else {
    331335        mr_asprintf(zipparams, "");
    332336    }
     337
     338//  make_hole_for_file(fname);
    333339
    334340    if (!does_file_exist(bkpinfo->tmpdir)) {
     
    340346        fatal_error("scratchdir not found");
    341347    }
    342     mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname, fname, bkpinfo->zip_suffix);
     348    mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
     349            fname, bkpinfo->zip_suffix);
    343350    paranoid_system(command);
    344     mr_free(command);
    345 
    346     mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    347     mr_free(zipparams);
     351    paranoid_free(command);
     352
     353    mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s",
     354            TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
     355    paranoid_free(zipparams);
    348356
    349357    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    350358    if (system(tmp)) {
    351         mr_free(tmp);
     359        paranoid_free(tmp);
    352360        fatal_error("Unable to write tarball to scratchdir");
    353361    }
    354     mr_free(tmp);
     362    paranoid_free(tmp);
    355363
    356364    for (res = 99, tries = 0; tries < 3 && res != 0; tries++) {
     
    398406{
    399407    int retval = 0, res = 0;
    400     char *tmp = NULL;
     408    char *tmp;
    401409
    402410    assert(bkpinfo != NULL);
    403411    set_g_cdrom_and_g_dvd_to_bkpinfo_value();
     412    malloc_string(tmp);
    404413    if (bkpinfo->backup_media_type == dvd) {
    405414#ifdef DVDRWFORMAT
     
    422431    }
    423432
    424     mr_asprintf(tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
     433/*
     434      sprintf(tmp, "wc -l %s/archives/filelist.full > %s/archives/filelist.count",bkpinfo->scratchdir, bkpinfo->scratchdir);
     435      if (run_program_and_log_output(tmp, 2))
     436        { fatal_error("Failed to count filelist.full"); }
     437*/
     438    sprintf(tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
    425439    if (run_program_and_log_output(tmp, 2)) {
    426         mr_free(tmp);
    427440        fatal_error("Failed to gzip filelist.full");
    428441    }
    429     mr_free(tmp);
    430 
    431     mr_asprintf(tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     442    sprintf(tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir,
     443            bkpinfo->tmpdir);
    432444    if (run_program_and_log_output(tmp, 2)) {
    433         mr_free(tmp);
    434445        fatal_error("Failed to copy to tmpdir");
    435446    }
    436     mr_free(tmp);
    437447
    438448    copy_mondo_and_mindi_stuff_to_scratchdir(); // payload, too, if it exists
     
    454464    }
    455465    retval += do_that_initial_phase();  // prepare
    456     mr_asprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
     466    sprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
    457467    run_program_and_log_output(tmp, 1);
    458     mr_free(tmp);
    459 
    460468    retval += make_those_afios_phase(); // backup regular files
    461469    retval += make_those_slices_phase();    // backup BIG files
     
    465473        sleep(2);
    466474    }
     475    paranoid_free(tmp);
    467476    return (retval);
    468477}
     
    505514    char *use_lzo_sz = NULL;
    506515    char *use_gzip_sz = NULL;
    507     char *use_lzma_sz = NULL;
    508516    char *use_comp_sz = NULL;
    509517    char *use_star_sz = NULL;
     
    534542    assert(bkpinfo != NULL);
    535543
    536     mvaddstr_and_log_it(g_currentY, 0, "Calling MINDI to create boot+data disks");
     544    mvaddstr_and_log_it(g_currentY, 0,
     545                        "Calling MINDI to create boot+data disks");
    537546    open_evalcall_form("Calling MINDI to create boot+data disks");
    538547    mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir);
     
    541550        mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    542551        if (!does_file_exist(tmp)) {
    543             mr_free(tmp);
    544             fatal_error ("Cannot find filelist.full, so I cannot count its lines");
     552            fatal_error
     553                ("Cannot find filelist.full, so I cannot count its lines");
    545554        }
    546555    }
     
    562571            }
    563572        }
    564         mr_free(ntapedev);
     573        paranoid_free(ntapedev);
    565574        mr_asprintf(tape_device, "%s", bkpinfo->media_device);
    566575    } else {
     
    577586    } else {
    578587        mr_asprintf(use_gzip_sz, "no");
    579     }
    580     if (bkpinfo->use_lzma) {
    581         mr_asprintf(use_lzma_sz, "yes");
    582     } else {
    583         mr_asprintf(use_lzma_sz, "no");
    584588    }
    585589    if (bkpinfo->use_star) {
     
    656660            ch = 'U';
    657661        if (bkpinfo->boot_loader != '\0') {
    658             log_msg(2, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
     662            mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
     663            log_msg(2, tmp);
     664            mr_free(tmp);
    659665        } else {
    660666            bkpinfo->boot_loader = ch;
    661667        }
    662668        if (bkpinfo->boot_device[0] != '\0') {
    663             log_msg(2, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
     669            mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
     670            log_msg(2, tmp);
     671            mr_free(tmp);
    664672        } else {
    665673            strcpy(bkpinfo->boot_device, bootdev);
     
    684692        mr_asprintf(bootldr_str, "LILO");
    685693        if (!does_file_exist("/etc/lilo.conf")) {
    686             fatal_error("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?");
     694            fatal_error
     695                ("The de facto standard location for your boot loader's config file is /etc/lilo.conf but I cannot find it there. What is wrong with your Linux distribution?");
    687696        }
    688697    } else if (bkpinfo->boot_loader == 'G') {
    689698        mr_asprintf(bootldr_str, "GRUB");
    690         if (!does_file_exist("/boot/grub/menu.lst") && does_file_exist("/boot/grub/grub.conf")) {
    691             run_program_and_log_output("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5);
     699        if (!does_file_exist("/boot/grub/menu.lst")
     700            && does_file_exist("/boot/grub/grub.conf")) {
     701            run_program_and_log_output
     702                ("ln -sf /boot/grub/grub.conf /boot/grub/menu.lst", 5);
    692703        }
    693704        if ((!does_file_exist("/boot/grub/menu.lst")) && (!does_file_exist("/boot/grub/grub.cfg")) && (!does_file_exist("/boot/grub2/grub.cfg"))) {
    694             fatal_error("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
     705            fatal_error
     706                ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
    695707        }
    696708        mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));
     
    698710        mr_asprintf(bootldr_str, "ELILO");
    699711        /* BCO: fix it for Debian, Mandrake, ... */
    700         if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) {
    701             run_program_and_log_output("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf", 5);
    702         }
    703         if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) {
    704             run_program_and_log_output("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf", 5);
    705         }
    706         if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/efi/debian/elilo.conf")) {
    707             run_program_and_log_output ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf", 5);
    708         }
    709         if (!does_file_exist("/etc/elilo.conf") && does_file_exist("/boot/efi/debian/elilo.conf")) {
    710             run_program_and_log_output ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf", 5);
     712        if (!does_file_exist("/etc/elilo.conf")
     713            && does_file_exist("/boot/efi/efi/redhat/elilo.conf")) {
     714            run_program_and_log_output
     715                ("ln -sf /boot/efi/efi/redhat/elilo.conf /etc/elilo.conf",
     716                 5);
     717        }
     718        if (!does_file_exist("/etc/elilo.conf")
     719            && does_file_exist("/boot/efi/efi/SuSE/elilo.conf")) {
     720            run_program_and_log_output
     721                ("ln -sf /boot/efi/efi/SuSE/elilo.conf /etc/elilo.conf",
     722                 5);
     723        }
     724        if (!does_file_exist("/etc/elilo.conf")
     725            && does_file_exist("/boot/efi/efi/debian/elilo.conf")) {
     726            run_program_and_log_output
     727                ("ln -sf /boot/efi/efi/debian/elilo.conf /etc/elilo.conf",
     728                 5);
     729        }
     730        if (!does_file_exist("/etc/elilo.conf")
     731            && does_file_exist("/boot/efi/debian/elilo.conf")) {
     732            run_program_and_log_output
     733                ("ln -sf /boot/efi/debian/elilo.conf /etc/elilo.conf",
     734                 5);
    711735        }
    712736        if (!does_file_exist("/etc/elilo.conf")) {
    713             fatal_error("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'");
     737            fatal_error
     738                ("The de facto mondo standard location for your boot loader's config file is /etc/elilo.conf but I cannot find it there. What is wrong with your Linux distribution? Try finding it under /boot/efi and do 'ln -s /boot/efi/..../elilo.conf /etc/elilo.conf'");
    714739        }
    715740    } else if (bkpinfo->boot_loader == 'R') {
     
    728753        mr_asprintf(bootldr_str, "unknown");
    729754    }
    730     log_to_screen("Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    731 
     755    mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
     756    log_to_screen(tmp);
     757    mr_free(tmp);
    732758    if (bootldr_ver != NULL) {
    733         log_to_screen("Boot loader version string: %s", bootldr_ver);
     759        mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver);
     760        log_to_screen(tmp);
     761        mr_free(tmp);
    734762    }
    735763
     
    771799        fatal_error("Unknown backup_media_type");
    772800    }
    773 
    774     if ((bkpinfo->backup_media_type == usb) && (bkpinfo->media_device)) {
     801    if (bkpinfo->backup_media_type == usb) {
    775802        mr_asprintf(tmp2, "--usb %s", bkpinfo->media_device);
    776803    } else {
     
    781808    if (write_one_liner_data_file(tmp, value)) {
    782809        res++;
    783         log_msg(1, "%ld: Unable to write one-liner backup-media-type", __LINE__);
     810        log_msg(1, "%ld: Unable to write one-liner backup-media-type",
     811                __LINE__);
    784812    }
    785813    mr_free(value);
     
    789817    if (write_one_liner_data_file(tmp, bootldr_str)) {
    790818        res++;
    791         log_msg(1, "%ld: Unable to write one-liner bootloader.name", __LINE__);
     819        log_msg(1, "%ld: Unable to write one-liner bootloader.name",
     820                __LINE__);
    792821    }
    793822    mr_free(bootldr_str);
     
    836865    }
    837866
    838     estimated_total_noof_slices = size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    839 
    840     /* TODO: add netfs stuff here? */
     867    estimated_total_noof_slices =
     868        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
     869    /* add netfs stuff here? */
    841870    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    842871    if (system(command)) {
     
    844873        log_OS_error("Unable to make images directory");
    845874    }
    846     mr_free(command);
     875    paranoid_free(command);
    847876    log_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    848877    update_evalcall_form(3);
     
    861890            use_lzo_sz,         // parameter #8
    862891            cd_recovery_sz,     // parameter #9
    863             (bkpinfo->image_devs == NULL) ? "\"\"" : bkpinfo->image_devs,   // parameter #10
     892            bkpinfo->image_devs,    // parameter #10
    864893            broken_bios_sz,     // parameter #11
    865894            last_filelist_number,   // parameter #12 (STRING)
     
    871900            bkpinfo->internal_tape_block_size,  // parameter #18 (LONG)
    872901            bkpinfo->differential,  // parameter #19 (INT)
    873             use_gzip_sz,        // parameter #19 (STRING)
    874             use_lzma_sz,        // parameter #20 (STRING)
    875             value,              // parameter #21 (STRING)
    876             MONDO_LOGFILE);
     902            use_gzip_sz);       // parameter #20 (STRING)
    877903
    878904    mr_free(last_filelist_number);
     
    880906    mr_free(use_lzo_sz);
    881907    mr_free(use_gzip_sz);
    882     mr_free(use_lzma_sz);
    883908    mr_free(use_star_sz);
    884909    mr_free(use_comp_sz);
     
    888913    mr_free(tape_size_sz);
    889914
    890     /* This parameter is always the last one and optional */
    891915    if (bkpinfo->nonbootable_backup) {
    892916        mr_strcat(command, " NONBOOTABLE");
     
    905929    if (!res) {
    906930        log_to_screen("Boot+data disks were created OK");
    907         mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);
     931        mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso",
     932                bkpinfo->scratchdir, MINDI_CACHE);
    908933        log_msg(2, command);
    909934        run_program_and_log_output(command, FALSE);
    910         mr_free(command);
     935        paranoid_free(command);
    911936
    912937        if (bkpinfo->nonbootable_backup) {
    913             mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
     938            mr_asprintf(command, "cp -f %s/all.tar.gz %s/images",
     939                    bkpinfo->tmpdir, bkpinfo->scratchdir);
    914940            if (system(command)) {
    915                 mr_free(command);
     941                paranoid_free(command);
    916942                fatal_error("Unable to create temporary all tarball");
    917943            }
    918             mr_free(command);
     944            paranoid_free(command);
    919945        }
    920946        /* For USB we already have everything on the key */
     
    922948            mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir);
    923949            run_program_and_log_output(command, FALSE);
    924             mr_free(command);
     950            paranoid_free(command);
    925951        } else {
    926             mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     952            mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir,
     953                bkpinfo->tmpdir);
    927954            if (system(tmp)) {
    928955                fatal_error("Cannot find all.tar.gz in tmpdir");
     
    939966        mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
    940967        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    941         mr_free(command);
     968        paranoid_free(command);
    942969
    943970        if (strlen(tmp) > 1) {
     
    9901017void *create_afio_files_in_background(void *inbuf)
    9911018{
    992     long int archiving_set_no = 0L;
    993     char *archiving_filelist_fname = NULL;
    994     char *archiving_afioball_fname = NULL;
     1019    long int archiving_set_no;
     1020    char *archiving_filelist_fname;
     1021    char *archiving_afioball_fname;
    9951022    char *curr_xattr_list_fname = NULL;
    996     char *curr_acl_list_fname = NULL;
    997 
    998     char *tmp = NULL;
     1023    char *curr_acl_list_fname;
     1024
     1025    char *tmp;
    9991026    int res = 0, retval = 0;
    10001027    int *p_archival_threads_running;
     
    10041031    int this_thread_no = g_current_thread_no++;
    10051032
     1033    malloc_string(curr_xattr_list_fname);
     1034    malloc_string(curr_acl_list_fname);
     1035    malloc_string(archiving_filelist_fname);
     1036    malloc_string(archiving_afioball_fname);
     1037    malloc_string(tmp);
    10061038    p_last_set_archived = (int *) inbuf;
    10071039    p_archival_threads_running = (int *) (inbuf + 4);
     
    10091041    p_list_of_fileset_flags = (char *) (inbuf + 12);
    10101042
    1011     mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, 0L);
    1012 
    1013     while (does_file_exist(archiving_filelist_fname)) {
     1043    sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
     1044            bkpinfo->tmpdir, 0L);
     1045    for (archiving_set_no = 0L; does_file_exist(archiving_filelist_fname);
     1046         sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
     1047                 bkpinfo->tmpdir, archiving_set_no)) {
    10141048        if (g_exiting) {
    1015             mr_free(archiving_filelist_fname);
    10161049            fatal_error("Execution run aborted (pthread)");
    10171050        }
    10181051        if (archiving_set_no >= MAX_NOOF_SETS_HERE) {
    1019             mr_free(archiving_filelist_fname);
    1020             fatal_error("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please.");
     1052            fatal_error
     1053                ("Maximum number of filesets exceeded. Adjust MAX_NOOF_SETS_HERE, please.");
    10211054        }
    10221055        if (!semaphore_p()) {
    10231056            log_msg(3, "P sem failed (pid=%d)", (int) getpid());
    1024             mr_free(archiving_filelist_fname);
    10251057            fatal_error("Cannot get semaphore P");
    10261058        }
     
    10301062        *p_next_set_to_archive = *p_next_set_to_archive + 1;
    10311063        if (!semaphore_v()) {
    1032             mr_free(archiving_filelist_fname);
    10331064            fatal_error("Cannot get semaphore V");
    10341065        }
    10351066
    10361067        /* backup this set of files */
    1037         mr_asprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
    1038         mr_free(archiving_filelist_fname);
    1039         mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1068        sprintf(archiving_afioball_fname, AFIOBALL_FNAME_RAW_SZ,
     1069                bkpinfo->tmpdir, archiving_set_no, bkpinfo->zip_suffix);
     1070        sprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ,
     1071                bkpinfo->tmpdir, archiving_set_no);
    10401072        if (!does_file_exist(archiving_filelist_fname)) {
    1041             log_msg(3, "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no);
    1042             mr_free(archiving_afioball_fname);
     1073            log_msg(3,
     1074                    "%s[%d:%d] - well, I would archive %d, except that it doesn't exist. I'll stop now.",
     1075                    FORTY_SPACES, getpid(), this_thread_no,
     1076                    archiving_set_no);
    10431077            break;
    10441078        }
    10451079
    1046         mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
     1080        sprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir,
     1081                archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
    10471082        if (does_file_exist(tmp)) {
    1048             log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES, getpid(), this_thread_no);
     1083            log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,
     1084                    getpid(), this_thread_no);
    10491085            while (does_file_exist(tmp)) {
    10501086                sleep(1);
     
    10521088            log_msg(4, "[%d] - continuing", getpid());
    10531089        }
    1054         mr_free(tmp);
    1055 
    1056         log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no);
    1057 
     1090
     1091        log_msg(4, "%s[%d:%d] - EXATing %d...", FORTY_SPACES, getpid(),
     1092                this_thread_no, archiving_set_no);
    10581093        if (g_getfattr) {
    1059             mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1094            sprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
     1095                bkpinfo->tmpdir, archiving_set_no);
    10601096            get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname);
    1061             mr_free(curr_xattr_list_fname);
    10621097        }
    10631098        if (g_getfacl) {
    1064             mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1099            sprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ,
     1100                bkpinfo->tmpdir, archiving_set_no);
    10651101            get_acl_list(archiving_filelist_fname, curr_acl_list_fname);
    1066             mr_free(curr_acl_list_fname);
    1067         }
    1068 
    1069         log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no);
    1070         res = archive_this_fileset(archiving_filelist_fname, archiving_afioball_fname, archiving_set_no);
    1071         mr_free(archiving_afioball_fname);
    1072 
     1102        }
     1103
     1104        log_msg(4, "%s[%d:%d] - archiving %d...", FORTY_SPACES, getpid(),
     1105                this_thread_no, archiving_set_no);
     1106        res =
     1107            archive_this_fileset(archiving_filelist_fname,
     1108                                 archiving_afioball_fname,
     1109                                 archiving_set_no);
    10731110        retval += res;
    10741111
    10751112        if (res) {
    1076             log_to_screen("Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    1077         }
    1078 
     1113            sprintf(tmp,
     1114                    "Errors occurred while archiving set %ld. Please review logs.",
     1115                    archiving_set_no);
     1116            log_to_screen(tmp);
     1117        }
    10791118        if (!semaphore_p()) {
    1080             mr_free(archiving_filelist_fname);
    10811119            fatal_error("Cannot get semaphore P");
    10821120        }
     
    10891127
    10901128        if (!semaphore_v()) {
    1091             mr_free(archiving_filelist_fname);
    10921129            fatal_error("Cannot get semaphore V");
    10931130        }
    1094         log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(), this_thread_no, archiving_set_no);
     1131        log_msg(4, "%s[%d:%d] - archived %d OK", FORTY_SPACES, getpid(),
     1132                this_thread_no, archiving_set_no);
    10951133        archiving_set_no++;
    1096 
    1097         mr_free(archiving_filelist_fname);
    1098         mr_asprintf(archiving_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    1099     }
    1100     mr_free(archiving_filelist_fname);
    1101 
     1134    }
    11021135    if (!semaphore_p()) {
    11031136        fatal_error("Cannot get semaphore P");
     
    11071140        fatal_error("Cannot get semaphore V");
    11081141    }
    1109     log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(), this_thread_no);
     1142    log_msg(3, "%s[%d:%d] - exiting", FORTY_SPACES, getpid(),
     1143            this_thread_no);
     1144    paranoid_free(archiving_filelist_fname);
     1145    paranoid_free(archiving_afioball_fname);
     1146    paranoid_free(curr_xattr_list_fname);
     1147    paranoid_free(curr_acl_list_fname);
     1148    paranoid_free(tmp);
    11101149    pthread_exit(NULL);
    11111150}
     
    11891228
    11901229    /*@ buffers *********************************** */
    1191     char *command = NULL;
    1192     char *tmpfile = NULL;
    1193     char *data_disks_file = NULL;
     1230    char *command, *tmpfile, *data_disks_file;
    11941231
    11951232    assert(bkpinfo != NULL);
    1196     mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
    1197 
    1198     snprintf(g_serial_string, MAX_STR_LEN - 8, "%s", call_program_and_get_last_line_of_output("dd if=/dev/urandom bs=16 count=1 2> /dev/null | hexdump | tr -s ' ' '0' | head -n1"));
     1233    malloc_string(command);
     1234    malloc_string(tmpfile);
     1235    malloc_string(data_disks_file);
     1236    sprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
     1237
     1238    snprintf(g_serial_string, MAX_STR_LEN - 8, "%s",
     1239             call_program_and_get_last_line_of_output("dd \
     1240if=/dev/urandom bs=16 count=1 2> /dev/null | \
     1241hexdump | tr -s ' ' '0' | head -n1"));
    11991242    strip_spaces(g_serial_string);
    12001243    strcat(g_serial_string, "...word.");
     
    12021245    assert(strlen(g_serial_string) < MAX_STR_LEN);
    12031246
    1204     mr_asprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
     1247    sprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
    12051248    if (write_one_liner_data_file(tmpfile, g_serial_string)) {
    12061249        log_msg(1, "%ld: Failed to write serial string", __LINE__);
    12071250    }
    1208     mr_free(tmpfile);
    12091251
    12101252    mvaddstr_and_log_it(g_currentY, 0, "Preparing to archive your data");
     
    12271269        }
    12281270    }
    1229     mr_free(data_disks_file);
    1230 
    1231     mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->netfs_remote_dir, bkpinfo->prefix);
     1271
     1272    sprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir,
     1273            bkpinfo->netfs_remote_dir, bkpinfo->prefix);
    12321274    paranoid_system(command);
    1233     mr_free(command);
    1234 
    12351275    wipe_archives(bkpinfo->scratchdir);
    12361276    mvaddstr_and_log_it(g_currentY++, 74, "Done.");
     
    12411281                                     BLK_START_OF_BACKUP);
    12421282    }
     1283    paranoid_free(command);
     1284    paranoid_free(tmpfile);
     1285    paranoid_free(data_disks_file);
    12431286    return (retval);
    12441287}
     
    13131356
    13141357    /*@ buffers ********************************************** */
    1315     char *storing_filelist_fname = NULL;
    1316     char *storing_afioball_fname = NULL;
     1358    char *storing_filelist_fname;
     1359    char *storing_afioball_fname;
    13171360    char *tmp = NULL;
    13181361    char *media_usage_comment = NULL;
     
    13311374    assert(bkpinfo != NULL);
    13321375    malloc_string(result_str);
    1333     transfer_block = malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
    1334     memset((void *) transfer_block, 0, sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     1376    malloc_string(curr_xattr_list_fname);
     1377    malloc_string(curr_acl_list_fname);
     1378    malloc_string(storing_filelist_fname);
     1379    malloc_string(storing_afioball_fname);
     1380    transfer_block =
     1381        malloc(sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
     1382    memset((void *) transfer_block, 0,
     1383           sizeof(struct s_bkpinfo) + BKPINFO_LOC_OFFSET + 64);
    13351384    p_last_set_archived = (int *) transfer_block;
    13361385    p_archival_threads_running = (int *) (transfer_block + 4);
    13371386    p_next_set_to_archive = (int *) (transfer_block + 8);
    13381387    p_list_of_fileset_flags = (char *) (transfer_block + 12);
    1339     memcpy((void *) (transfer_block + BKPINFO_LOC_OFFSET), (void *) bkpinfo, sizeof(struct s_bkpinfo));
     1388    memcpy((void *) (transfer_block + BKPINFO_LOC_OFFSET),
     1389           (void *) bkpinfo, sizeof(struct s_bkpinfo));
    13401390    pvp = &vp;
    13411391    vp = (void *) result_str;
     
    13491399                       "Please wait. This may take a couple of hours.",
    13501400                       "Working...",
    1351                        (long)get_last_filelist_number() + 1L);
     1401                       get_last_filelist_number() + 1);
    13521402
    13531403    log_msg(5, "We're gonna party like it's your birthday.");
     
    13881438            if (!get_bit_N_of_array
    13891439                (p_list_of_fileset_flags, storing_set_no)) {
    1390             misc_counter_that_is_not_important = (misc_counter_that_is_not_important + 1) % 5;
     1440            misc_counter_that_is_not_important =
     1441                (misc_counter_that_is_not_important + 1) % 5;
    13911442            /* BCO the media_usage_comment is not really initialized there !
    13921443            if (!misc_counter_that_is_not_important) {
     
    13951446            */
    13961447            sleep(1);
    1397             } else {
     1448            } else
    13981449                // store set N
    1399                 mr_asprintf(storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    1400                 mr_asprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
     1450            {
     1451                sprintf(storing_filelist_fname, FILELIST_FNAME_RAW_SZ,
     1452                        bkpinfo->tmpdir, storing_set_no);
     1453                sprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ,
     1454                        bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
    14011455                if (g_getfattr) {
    1402                     mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1456                    sprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ,
     1457                        bkpinfo->tmpdir, storing_set_no);
    14031458                }
    14041459                if (g_getfacl) {
    1405                     mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1460                    sprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ,
     1461                        bkpinfo->tmpdir, storing_set_no);
    14061462                }
    14071463
     
    14141470                    sleep(5);
    14151471                }
     1472                mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    14161473                /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    14171474                if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    14181475                    register_in_tape_catalog(fileset, storing_set_no, -1,
    14191476                                         storing_afioball_fname);
    1420                     maintain_collection_of_recent_archives(bkpinfo->tmpdir, storing_afioball_fname);
     1477                    maintain_collection_of_recent_archives(bkpinfo->tmpdir,
     1478                                                       storing_afioball_fname);
    14211479                    log_it("Writing EXAT files");
    14221480                    res +=
     
    14521510                retval += res;
    14531511                g_current_progress++;
    1454                 mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    14551512                update_progress_form(media_usage_comment);
    14561513                mr_free(media_usage_comment);
    14571514                if (res) {
    1458                     log_to_screen("Failed to add archive %ld's files to CD dir\n", storing_set_no);
    1459                     fatal_error("Is your hard disk full? If not, please send the author the logfile.");
     1515                    mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n",
     1516                        storing_set_no);
     1517                    log_to_screen(tmp);
     1518                    paranoid_free(tmp);
     1519                    fatal_error
     1520                        ("Is your hard disk full? If not, please send the author the logfile.");
    14601521                }
    14611522                storing_set_no++;
    14621523                //      sleep(2);
    1463                 if (g_getfacl) {
    1464                     mr_free(curr_acl_list_fname);
    1465                 }
    1466                 if (g_getfattr) {
    1467                     mr_free(curr_xattr_list_fname);
    1468                 }
    1469                 mr_free(storing_filelist_fname);
    1470                 mr_free(storing_afioball_fname);
    14711524        }
    14721525    }
     
    14871540    }
    14881541    log_to_screen(tmp);
    1489     mr_free(tmp);
     1542    paranoid_free(tmp);
    14901543
    14911544    paranoid_free(transfer_block);
    14921545    paranoid_free(result_str);
     1546    paranoid_free(storing_filelist_fname);
     1547    paranoid_free(storing_afioball_fname);
     1548    paranoid_free(curr_xattr_list_fname);
     1549    paranoid_free(curr_acl_list_fname);
    14931550    return (retval);
    14941551}
     
    15411598    mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir);
    15421599    run_program_and_log_output(tmp, FALSE);
    1543     mr_free(tmp);
     1600    paranoid_free(tmp);
    15441601    if (chdir(bkpinfo->scratchdir)) {
    15451602        // FIXME
     
    15511608    log_msg(1, message_to_screen);
    15521609
    1553     if (bkpinfo->media_device) {
    1554         mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
    1555     } else {
    1556         mr_asprintf(tmp1, "");
    1557     }
     1610    mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
    15581611    if (is_this_device_mounted(tmp1)) {
    15591612        log_msg(1, "USB device mounted. Remounting it at the right place");
    15601613        mr_asprintf(tmp, "umount %s", tmp1);
    15611614        run_program_and_log_output(tmp, FALSE);
    1562         mr_free(tmp);
    1563     }
    1564     mr_free(tmp1);
     1615        paranoid_free(tmp);
     1616    }
     1617    paranoid_free(tmp1);
    15651618
    15661619    log_msg(1, "Mounting USB device.");
     
    15681621    mr_asprintf(tmp, "mkdir -p %s", tmp1);
    15691622    run_program_and_log_output(tmp, FALSE);
    1570     mr_free(tmp);
    1571 
     1623    paranoid_free(tmp);
    15721624
    15731625    /* Mindi always create one single parition on the USB dev */
    15741626    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    15751627    run_program_and_log_output(tmp, FALSE);
    1576     mr_free(tmp);
     1628    paranoid_free(tmp);
    15771629
    15781630    if (bkpinfo->nonbootable_backup) {
     
    15901642        }
    15911643        log_to_screen(result_sz);
    1592         mr_free(result_sz);
    1593         mr_free(tmp);
     1644        paranoid_free(result_sz);
     1645        paranoid_free(tmp);
    15941646        retval += res;
    15951647
     
    15971649        mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    15981650        run_program_and_log_output(tmp, FALSE);
    1599         mr_free(tmp);
     1651        paranoid_free(tmp);
    16001652    }
    16011653    paranoid_free(message_to_screen);
     
    16051657        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    16061658        run_program_and_log_output(tmp, FALSE);
    1607         mr_free(tmp);
     1659        paranoid_free(tmp);
    16081660    }
    16091661
     
    16431695
    16441696    /*@ buffers ****************************************** */
    1645     char *tmp = NULL;
    1646     char *tmp2 = NULL;
     1697    char *tmp;
    16471698    char *old_pwd;
    16481699    char *result_sz = NULL;
    16491700    char *message_to_screen = NULL;
    16501701    char *sz_blank_disk = NULL;
    1651     char *fnam = NULL;
    1652     char *tmp3 = NULL;
     1702    char *fnam;
     1703    char *tmp2;
     1704    char *tmp3;
    16531705    char *isofs_cmd = NULL;
    16541706    char *full_isofs_cmd = NULL;
     
    16581710    malloc_string(old_pwd);
    16591711    malloc_string(fnam);
     1712    tmp = malloc(1200);
     1713    tmp2 = malloc(1200);
     1714    tmp3 = malloc(1200);
    16601715    assert(bkpinfo != NULL);
    16611716    assert_string_is_neither_NULL_nor_zerolength(destfile);
    16621717
    1663     /* Copy the files needed by isolinux in the right dir */
    1664     mr_asprintf(tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
    1665     mr_asprintf(tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
     1718    sprintf(tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
     1719    sprintf(tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
    16661720    if (does_file_exist(tmp)) {
    1667         mr_asprintf(tmp3, "cp -f %s %s", tmp, tmp2);
     1721        sprintf(tmp3, "cp -f %s %s", tmp, tmp2);
    16681722        paranoid_system(tmp3);
    1669         mr_free(tmp3);
    16701723    }
    16711724    if (!does_file_exist(tmp) && does_file_exist(tmp2)) {
    1672         mr_asprintf(tmp3, "cp -f %s %s", tmp2, tmp);
     1725        sprintf(tmp3, "cp -f %s %s", tmp2, tmp);
    16731726        paranoid_system(tmp3);
    1674         mr_free(tmp3);
    1675     }
    1676     mr_free(tmp2);
    1677     mr_free(tmp3);
     1727    }
     1728    free(tmp2);
     1729    free(tmp3);
     1730    tmp2 = NULL;
     1731    tmp3 = NULL;
    16781732    if (bkpinfo->backup_media_type == iso && bkpinfo->manual_cd_tray) {
    16791733        popup_and_OK("Please insert new media and press Enter.");
    16801734    }
    16811735
    1682     log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile);
     1736    log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s",
     1737            bkpinfo->scratchdir, destfile);
    16831738    tmp2 = getcwd(old_pwd, MAX_STR_LEN - 1);
    1684     if (! tmp2) {
    1685         //FIXME
    1686     }
    1687     mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir);
     1739    sprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir);
    16881740    run_program_and_log_output(tmp, FALSE);
    1689     mr_free(tmp);
    1690 
    16911741    if (chdir(bkpinfo->scratchdir)) {
    16921742        // FIXME
     
    16941744
    16951745    if (bkpinfo->call_before_iso[0] != '\0') {
    1696         mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
    1697         res = eval_call_to_make_ISO(bkpinfo->call_before_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1746        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d",
     1747                g_current_media_number);
     1748        res =
     1749            eval_call_to_make_ISO(bkpinfo->call_before_iso,
     1750                                  destfile, g_current_media_number,
     1751                                  MONDO_LOGFILE, message_to_screen);
    16981752        if (res) {
    16991753            mr_strcat(message_to_screen, "...failed");
     
    17091763    if (bkpinfo->call_make_iso[0] != '\0') {
    17101764        log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);
     1765        sprintf(tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    17111766        mds = media_descriptor_string(bkpinfo->backup_media_type);
    17121767        mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
     
    17191774        } else {
    17201775            res =
    1721                 eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1776                eval_call_to_make_ISO(bkpinfo->call_make_iso,
     1777                                      bkpinfo->scratchdir,
     1778                                      g_current_media_number,
     1779                                      MONDO_LOGFILE, message_to_screen);
    17221780            if (res) {
    17231781                log_to_screen("%s...failed to write", message_to_screen);
    17241782            } else {
    17251783                log_to_screen("%s...OK", message_to_screen);
    1726                 mr_asprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
     1784                sprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
    17271785                if (!run_program_and_log_output(tmp, 1)) {
    17281786                    log_to_screen
    17291787                        ("Despite nonfatal errors, growisofs confirms the write was successful.");
    17301788                }
    1731                 mr_free(tmp);
    17321789            }
    17331790            retval += res;
    17341791#ifdef DVDRWFORMAT
    1735             mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
     1792            sprintf(tmp,
     1793                    "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'",
     1794                    MONDO_LOGFILE);
    17361795            if (g_backup_media_type == dvd
    17371796                && (res || !run_program_and_log_output(tmp, 1))) {
     
    17411800                /* reset error counter before trying to blank DVD */
    17421801                retval -= res;
    1743                 sync();
     1802                paranoid_system("sync");
    17441803                pause_for_N_seconds(5, "Letting DVD drive settle");
    17451804
     
    17511810                }
    17521811                pause_for_N_seconds(5, "Letting DVD drive settle");
    1753                 if (bkpinfo->media_device) {
    1754                     mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    1755                 } else {
    1756                     mr_asprintf(sz_blank_disk, "dvd+rw-format");
    1757                 }
     1812                mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    17581813                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    1759                 res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk);
     1814                res =
     1815                    run_external_binary_with_percentage_indicator_NEW
     1816                    ("Blanking DVD disk", sz_blank_disk);
    17601817                if (res) {
    1761                     log_to_screen("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath...");
    1762                     pause_for_N_seconds(5, "Letting DVD drive settle... and trying again.");
    1763                     res = run_external_binary_with_percentage_indicator_NEW("Blanking DVD disk", sz_blank_disk);
     1818                    log_to_screen
     1819                        ("Warning - format failed. (Was it a DVD-R?) Sleeping for 5 seconds to take a breath...");
     1820                    pause_for_N_seconds(5,
     1821                                        "Letting DVD drive settle... and trying again.");
     1822                    res =
     1823                        run_external_binary_with_percentage_indicator_NEW
     1824                        ("Blanking DVD disk", sz_blank_disk);
    17641825                    if (res) {
    17651826                        log_to_screen("Format failed a second time.");
     
    17771838                }
    17781839                pause_for_N_seconds(5, "Letting DVD drive settle");
    1779                 res = eval_call_to_make_ISO(bkpinfo->call_make_iso, bkpinfo->scratchdir, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1840                res =
     1841                    eval_call_to_make_ISO(bkpinfo->call_make_iso,
     1842                                          bkpinfo->scratchdir,
     1843                                          g_current_media_number,
     1844                                          MONDO_LOGFILE,
     1845                                          message_to_screen);
    17801846                retval += res;
    17811847                if (!bkpinfo->please_dont_eject) {
     
    17901856                }
    17911857            }
    1792             mr_free(tmp);
    17931858#endif
    17941859            if (g_backup_media_type == dvd && !bkpinfo->please_dont_eject) {
     
    18111876            log_msg(1, "Making nonbootable backup");
    18121877            mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
    1813             res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1878            res = eval_call_to_make_ISO(full_isofs_cmd,
     1879                                      destfile, g_current_media_number,
     1880                                      MONDO_LOGFILE, message_to_screen);
    18141881            mr_free(full_isofs_cmd);
    18151882        } else {
     
    18211888
    18221889
    1823             log_msg(1, "make_cd_use_lilo is actually %d", bkpinfo->make_cd_use_lilo);
     1890            log_msg(1, "make_cd_use_lilo is actually %d",
     1891                    bkpinfo->make_cd_use_lilo);
    18241892            if (bkpinfo->make_cd_use_lilo) {
    18251893                log_msg(1, "make_cd_use_lilo = TRUE");
     
    18271895                log_msg(1, "IA64 --> elilo");
    18281896                mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);
    1829                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1897                res = eval_call_to_make_ISO(full_isofs_cmd,
     1898                                            destfile,
     1899                                            g_current_media_number,
     1900                                            MONDO_LOGFILE,
     1901                                            message_to_screen);
    18301902                mr_free(full_isofs_cmd);
    18311903#else
    18321904                log_msg(1, "Non-ia64 --> lilo");
    18331905                mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
    1834                 // FIXME: fixed boot size probably wrong. lilo to be removed
    1835                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1906                res =
     1907                    // FIXME: fixed boot size probably wrong. lilo to be removed
     1908                    eval_call_to_make_ISO(full_isofs_cmd,
     1909                                          destfile, g_current_media_number,
     1910                                          MONDO_LOGFILE,
     1911                                          message_to_screen);
    18361912                mr_free(full_isofs_cmd);
    18371913#endif
     
    18401916                log_msg(1, "Isolinux");
    18411917                mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX);
    1842                 res = eval_call_to_make_ISO(full_isofs_cmd, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1918                res =
     1919                    eval_call_to_make_ISO(full_isofs_cmd,
     1920                                          destfile, g_current_media_number,
     1921                                          MONDO_LOGFILE,
     1922                                          message_to_screen);
    18431923                mr_free(full_isofs_cmd);
    18441924            }
     
    18601940        || bkpinfo->backup_media_type == cdrw) {
    18611941        if (is_this_device_mounted(bkpinfo->media_device)) {
    1862             log_msg(2, "Warning - %s mounted. I'm unmounting it before I burn to it.", bkpinfo->media_device);
    1863             mr_asprintf(tmp, "umount %s", bkpinfo->media_device);
     1942            log_msg(2,
     1943                    "Warning - %s mounted. I'm unmounting it before I burn to it.",
     1944                    bkpinfo->media_device);
     1945            sprintf(tmp, "umount %s", bkpinfo->media_device);
    18641946            run_program_and_log_output(tmp, FALSE);
    1865             mr_free(tmp);
    18661947        }
    18671948    }
     
    18731954        mr_free(mds);
    18741955        pause_and_ask_for_cdr(2, &cd_is_mountable);
    1875         res = eval_call_to_make_ISO(bkpinfo->call_burn_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1956        res =
     1957            eval_call_to_make_ISO(bkpinfo->call_burn_iso,
     1958                                  destfile, g_current_media_number,
     1959                                  MONDO_LOGFILE, message_to_screen);
    18761960        if (res) {
    18771961            mr_strcat(message_to_screen, "...failed");
     
    18891973        mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
    18901974        mr_free(mds);
    1891         res = eval_call_to_make_ISO(bkpinfo->call_after_iso, destfile, g_current_media_number, MONDO_LOGFILE, message_to_screen);
     1975        res =
     1976            eval_call_to_make_ISO(bkpinfo->call_after_iso,
     1977                                  destfile, g_current_media_number,
     1978                                  MONDO_LOGFILE, message_to_screen);
    18921979        if (res) {
    18931980            mr_strcat(message_to_screen, "...failed");
     
    19572044
    19582045    /*@ pointers ******************************************* */
    1959     FILE *fin = NULL;
     2046    FILE *fin;
    19602047    char *p;
    19612048    char *q;
     
    19632050    /*@ buffers ******************************************** */
    19642051    char *tmp = NULL;
    1965     char *bigfile_fname = NULL;
     2052    char *bigfile_fname;
    19662053    char *sz_devfile = NULL;
    19672054    char *ntfsprog_fifo = NULL;
     
    19992086    log_to_screen(tmp);
    20002087    noof_biggie_files = count_lines_in_file(biggielist_fname);
    2001     open_progress_form("Backing up big files", tmp, "Please wait. This may take some time.", "", estimated_total_noof_slices);
    2002     mr_free(tmp);
     2088    open_progress_form("Backing up big files", tmp,
     2089                       "Please wait. This may take some time.", "",
     2090                       estimated_total_noof_slices);
     2091    paranoid_free(tmp);
    20032092
    20042093    if (!(fin = fopen(biggielist_fname, "r"))) {
     
    20322121            log_msg(2, "bigfile_fname = %s", bigfile_fname);
    20332122            use_ntfsprog = FALSE;
    2034             if (!strncmp(bigfile_fname, "/dev/", 5) && is_dev_an_NTFS_dev(bigfile_fname)) {
     2123            if (!strncmp(bigfile_fname, "/dev/", 5)
     2124                && is_dev_an_NTFS_dev(bigfile_fname)) {
    20352125                use_ntfsprog = TRUE;
    2036                 log_msg(2, "Calling ntfsclone in background because %s is an NTFS partition", bigfile_fname);
    2037                 mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
     2126                log_msg(2,
     2127                        "Calling ntfsclone in background because %s is an NTFS partition",
     2128                        bigfile_fname);
     2129                mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,
     2130                        (int) (random() % 32768),
     2131                        (int) (random() % 32768));
    20382132                mkfifo(sz_devfile, 0x770);
    20392133                ntfsprog_fifo = sz_devfile;
     
    20432137                    fatal_error("Fork failure");
    20442138                case 0:
    2045                     log_msg(2, "CHILD - fip - calling feed_into_ntfsprog(%s, %s)", bigfile_fname, sz_devfile);
     2139                    log_msg(2,
     2140                            "CHILD - fip - calling feed_into_ntfsprog(%s, %s)",
     2141                            bigfile_fname, sz_devfile);
    20462142                    res = feed_into_ntfsprog(bigfile_fname, sz_devfile);
    20472143                    /* BCO/BERLIOS Does the child need to unalocate memory as well ?
    2048                     mr_free(bigfile_fname);
     2144                    paranoid_free(bigfile_fname);
    20492145                    mr_free(sz_devfile);
    20502146                    */
     
    20522148                    break;
    20532149                default:
    2054                     log_msg(2, "feed_into_ntfsprog() called in background --- pid=%ld", (long int) (pid));
     2150                    log_msg(2,
     2151                            "feed_into_ntfsprog() called in background --- pid=%ld",
     2152                            (long int) (pid));
    20552153                }
    20562154            }
     
    20622160            // Whether partition or biggiefile, just do your thang :-)
    20632161            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    2064                 write_header_block_to_stream(biggie_fsize, bigfile_fname, use_ntfsprog ?  BLK_START_A_PIHBIGGIE : BLK_START_A_NORMBIGGIE);
     2162                write_header_block_to_stream(biggie_fsize, bigfile_fname,
     2163                                             use_ntfsprog ?
     2164                                             BLK_START_A_PIHBIGGIE :
     2165                                             BLK_START_A_NORMBIGGIE);
    20652166            }
    2066             res = slice_up_file_etc(bigfile_fname, ntfsprog_fifo, biggie_file_number, noof_biggie_files, use_ntfsprog);
     2167            res =
     2168                slice_up_file_etc(bigfile_fname,
     2169                                  ntfsprog_fifo, biggie_file_number,
     2170                                  noof_biggie_files, use_ntfsprog);
    20672171
    20682172            /* Free it here as ntfsprog_fifo is not used anymore */
     
    20932197            }
    20942198        }
     2199#ifndef _XWIN
    20952200        if (!g_text_mode) {
    20962201            newtDrawRootText(0, g_noof_rows - 2, tmp);
    20972202            newtRefresh();
    20982203        }
    2099         mr_free(tmp);
    2100     }
    2101     mr_free(bigfile_fname);
    2102 
     2204#endif
     2205        paranoid_free(tmp);
     2206    }
    21032207    log_msg(1, "Finished backing up bigfiles");
    21042208    log_msg(1, "estimated slices = %ld; actual slices = %ld",
     
    21062210    close_progress_form();
    21072211    paranoid_fclose(fin);
     2212    paranoid_free(bigfile_fname);
    21082213    return (retval);
    21092214}
     
    21662271        retval += res;
    21672272        if (res) {
    2168             log_to_screen("Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    2169         }
     2273            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
     2274            log_to_screen(tmp);
     2275            mr_free(tmp);
     2276        }
     2277
     2278        mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    21702279
    21712280        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
     
    22102319        retval += res;
    22112320        g_current_progress++;
    2212 
    2213         mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    22142321        update_progress_form(media_usage_comment);
    22152322        mr_free(media_usage_comment);
    22162323
    22172324        if (res) {
    2218             log_to_screen("Failed to add archive %ld's files to CD dir\n", curr_set_no);
    2219             fatal_error("Is your hard disk is full? If not, please send the author the logfile.");
     2325            mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
     2326            log_to_screen(tmp);
     2327            mr_free(tmp);
     2328            fatal_error
     2329                ("Is your hard disk is full? If not, please send the author the logfile.");
    22202330        }
    22212331        mr_free(curr_filelist_fname);
     
    23182428    }
    23192429
    2320     mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir, biggielist);
     2430    mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
     2431            biggielist);
    23212432    paranoid_system(command);
    23222433    mr_free(command);
     
    23322443    if (g_getfattr) {
    23332444        get_fattr_list(biggielist, xattr_fname);
    2334         mr_asprintf(command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);
     2445        mr_asprintf(command, "cp %s %s/archives/", xattr_fname,
     2446            bkpinfo->scratchdir);
    23352447        paranoid_system(command);
    23362448        mr_free(command);
     
    26212733    /*@ buffers ********************************************* */
    26222734    char *tmp = NULL;
    2623     char *cdrom_dev = NULL;
    2624     char *cdrw_dev = NULL;
     2735    char *cdrom_dev;
     2736    char *cdrw_dev;
    26252737    char *our_serial_str = NULL;
    26262738    bool ok_go_ahead_burn_it;
     
    26282740    int attempt_to_mount_returned_this = 999;
    26292741    char *mtpt = NULL;
    2630     char *szcdno = NULL;
    2631     char *szserfname = NULL;
    2632     char *szunmount = NULL;
     2742    char *szcdno;
     2743    char *szserfname;
     2744    char *szunmount;
    26332745    char *mds = NULL;
    26342746
    26352747    malloc_string(cdrom_dev);
    26362748    malloc_string(cdrw_dev);
     2749    malloc_string(szcdno);
     2750    malloc_string(szserfname);
     2751    malloc_string(szunmount);
     2752    malloc_string(mtpt);
    26372753
    26382754    mds = media_descriptor_string(g_backup_media_type);
    2639     log_to_screen("I am about to burn %s #%d", mds, g_current_media_number);
     2755    mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number);
    26402756    mr_free(mds);
     2757    log_to_screen(tmp);
     2758    mr_free(tmp);
    26412759    if (g_current_media_number < ask_for_one_if_more_than_this) {
    26422760        return;
    26432761    }
    26442762    log_to_screen("Scanning CD-ROM drive...");
    2645     mr_asprintf(mtpt, "%s/cd.mtpt", bkpinfo->tmpdir);
     2763    sprintf(mtpt, "%s/cd.mtpt", bkpinfo->tmpdir);
    26462764    make_hole_for_dir(mtpt);
    26472765
     
    26492767    ok_go_ahead_burn_it = TRUE;
    26502768    if (!find_cdrom_device(cdrom_dev, FALSE)) {
    2651         /* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird
    2652         log_msg(2, "paafcd: Retracting CD-ROM drive if possible" );
    2653         retract_CD_tray_and_defeat_autorun();
    2654         */
     2769/* When enabled, it made CD eject-and-retract when wrong CD inserted.. Weird
     2770      log_msg(2, "paafcd: Retracting CD-ROM drive if possible" );
     2771      retract_CD_tray_and_defeat_autorun();
     2772*/
    26552773        mr_asprintf(tmp, "umount %s", cdrom_dev);
    26562774        run_program_and_log_output(tmp, 1);
    2657         mr_asprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
    2658         mr_asprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);
    2659         mr_asprintf(szunmount, "umount %s", mtpt);
     2775        sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
     2776        sprintf(szserfname, "%s/archives/SERIAL-STRING", mtpt);
     2777        sprintf(szunmount, "umount %s", mtpt);
    26602778        cd_number = -1;
    26612779        mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt);
     
    26632781        attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1);
    26642782        mr_free(tmp);
    2665 
    26662783        if (attempt_to_mount_returned_this) {
    26672784            log_msg(4, "Failed to mount %s at %s", cdrom_dev, mtpt);
    26682785            log_to_screen("If there's a CD/DVD in the drive, it's blank.");
    2669         } else if (!does_file_exist(szcdno) || !does_file_exist(szserfname)) {
     2786            /*
     2787               if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE))
     2788               {
     2789               ok_go_ahead_burn_it = FALSE;
     2790               log_to_screen("There isn't a writable CD/DVD in the drive.");
     2791               }
     2792               else
     2793               {
     2794               log_to_screen("Confirmed. There is a blank CD/DVD in the drive.");
     2795               }
     2796             */
     2797        } else if (!does_file_exist(szcdno)
     2798                   || !does_file_exist(szserfname)) {
    26702799            mds = media_descriptor_string(g_backup_media_type);
    2671             log_to_screen("%s has data on it but it's probably not a Mondo CD.", mds);
     2800            log_to_screen
     2801                ("%s has data on it but it's probably not a Mondo CD.", mds);
    26722802            mr_free(mds);
    26732803        } else {
     
    26792809            mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname);
    26802810            mr_free(our_serial_str);
    2681             mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));
     2811            mr_asprintf(our_serial_str, "%s",
     2812                   call_program_and_get_last_line_of_output(tmp));
    26822813            mr_free(tmp);
    26832814            // FIXME - should be able to use last_line_of_file(), surely?
    26842815        }
    2685         mr_free(szcdno);
    2686         mr_free(szserfname);
    2687 
    26882816        run_program_and_log_output(szunmount, 1);
    2689         mr_free(szunmount);
    2690 
    26912817        log_msg(2, "paafcd: cd_number = %d", cd_number);
    2692         log_msg(2, "our serial str = %s; g_serial_string = %s", our_serial_str, g_serial_string);
     2818        log_msg(2, "our serial str = %s; g_serial_string = %s",
     2819                our_serial_str, g_serial_string);
    26932820        if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) {
    26942821            mds = media_descriptor_string(g_backup_media_type);
     
    27222849        }
    27232850        mds = media_descriptor_string(g_backup_media_type);
    2724         mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", mds, g_current_media_number, mds);
     2851        mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
     2852                mds, g_current_media_number, mds);
    27252853        mr_free(mds);
    27262854
     
    27332861
    27342862    mds = media_descriptor_string(g_backup_media_type);
    2735     log_msg(2, "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds);
     2863    log_msg(2,
     2864            "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds);
    27362865
    27372866    log_to_screen("Proceeding w/ %s in drive.", mds);
     
    27402869    paranoid_free(cdrom_dev);
    27412870    paranoid_free(cdrw_dev);
    2742     mr_free(mtpt);
     2871    paranoid_free(mtpt);
     2872    paranoid_free(szcdno);
     2873    paranoid_free(szserfname);
     2874    paranoid_free(szunmount);
    27432875    if (pmountable) {
    27442876        if (attempt_to_mount_returned_this) {
     
    27502882
    27512883}
     2884
     2885
     2886
     2887
     2888
     2889
    27522890
    27532891
     
    27792917
    27802918/* @} - end of utilityGroup */
     2919
     2920
     2921
     2922
     2923
     2924
    27812925
    27822926
     
    28012945 */
    28022946int
    2803 slice_up_file_etc(char *biggie_filename, char *ntfsprog_fifo, long biggie_file_number, long noof_biggie_files, bool use_ntfsprog) {
     2947slice_up_file_etc(char *biggie_filename,
     2948                  char *ntfsprog_fifo, long biggie_file_number,
     2949                  long noof_biggie_files, bool use_ntfsprog)
     2950{
    28042951
    28052952    /*@ buffers ************************************************** */
    28062953    char *tmp = NULL;
    2807     char *checksum_line = NULL;
    2808     char *command = NULL;
    2809     char *tempblock = NULL;
     2954    char *checksum_line, *command;
     2955    char *tempblock;
    28102956    char *curr_slice_fname_uncompressed = NULL;
    28112957    char *curr_slice_fname_compressed = NULL;
    28122958    char *file_to_archive = NULL;
    2813     char *file_to_openin = NULL;
     2959    char *file_to_openin;
    28142960    /*@ pointers ************************************************** */
    2815     char *pB = NULL;
    2816     FILE *fin = NULL;
    2817     FILE *fout = NULL;
     2961    char *pB;
     2962    FILE *fin = NULL, *fout = NULL;
    28182963
    28192964    /*@ bool ****************************************************** */
     
    28212966
    28222967    /*@ long ****************************************************** */
    2823     size_t blksize = (size_t)0;
    2824     long slice_num = 0L;
    2825     long i = 0L;
    2826     bool should_I_compress_slices = TRUE;
     2968    size_t blksize = 0;
     2969    long slice_num = 0;
     2970    long i;
     2971    long optimal_set_size;
     2972    bool should_I_compress_slices;
    28272973    char *suffix = NULL;                // for compressed slices
    28282974
     
    28372983    /*@ structures ************************************************** */
    28382984    struct s_filename_and_lstat_info biggiestruct;
     2985//  struct stat statbuf;
    28392986
    28402987    assert(bkpinfo != NULL);
    28412988    assert_string_is_neither_NULL_nor_zerolength(biggie_filename);
     2989    malloc_string(checksum_line);
    28422990
    28432991    biggiestruct.for_backward_compatibility = '\n';
    28442992    biggiestruct.use_ntfsprog = use_ntfsprog;
    2845     if (is_this_file_compressed(biggie_filename) || bkpinfo->compression_level == 0) {
     2993    optimal_set_size = bkpinfo->optimal_set_size;
     2994    if (is_this_file_compressed(biggie_filename)
     2995        || bkpinfo->compression_level == 0) {
    28462996        mr_asprintf(suffix, "%s", "");
     2997        //      log_it("%s is indeed compressed :-)", filename);
    28472998        should_I_compress_slices = FALSE;
    28482999    } else {
     
    28513002    }
    28523003
    2853     if (bkpinfo->optimal_set_size < 999L) {
     3004    if (optimal_set_size < 999) {
    28543005        fatal_error("bkpinfo->optimal_set_size is insanely small");
    28553006    }
    2856 
    28573007    if (ntfsprog_fifo) {
    28583008        file_to_openin = ntfsprog_fifo;
    2859         mr_asprintf(checksum_line, "IGNORE");
    2860         log_msg(2, "Not calculating checksum for %s: it would take too long", biggie_filename);
     3009        strcpy(checksum_line, "IGNORE");
     3010        log_msg(2,
     3011                "Not calculating checksum for %s: it would take too long",
     3012                biggie_filename);
    28613013        if ( !find_home_of_exe("ntfsresize")) {
    28623014            fatal_error("ntfsresize not found");
     
    28683020        log_it("res of it = %s", tmp);
    28693021        totallength = (off_t)atoll(tmp);
    2870         mr_free(tmp);
     3022        paranoid_free(tmp);
    28713023    } else {
    28723024        file_to_openin = biggie_filename;
     
    28823034        }
    28833035        mr_free(command);
    2884         mr_getline(checksum_line, fin);
     3036        tmp = fgets(checksum_line, MAX_STR_LEN, fin);
    28853037        pclose(fin);
    28863038        totallength = length_of_file (biggie_filename);
     
    28963048    }
    28973049    strcpy(biggiestruct.checksum, checksum_line);
    2898     mr_free(checksum_line);
    28993050
    29003051    mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     
    29023053    if (fout == NULL) {
    29033054        log_msg(1, "Unable to open and write to %s\n", tmp);
    2904         mr_free(tmp);
     3055        paranoid_free(tmp);
    29053056        mr_free(suffix);
    29063057        return (1);
    29073058    }
    2908     mr_free(tmp);
     3059    paranoid_free(tmp);
    29093060
    29103061    res = fwrite((void *) &biggiestruct, 1, sizeof(biggiestruct), fout);
     
    29123063        paranoid_fclose(fout);
    29133064    }
    2914     log_msg(1, "Opening in %s; slicing it and writing to CD/tape", file_to_openin);
     3065    log_msg(1, "Opening in %s; slicing it and writing to CD/tape",
     3066            file_to_openin);
    29153067    if (!(fin = fopen(file_to_openin, "r"))) {
    29163068        log_OS_error("Unable to openin biggie_filename");
    2917         log_to_screen("Cannot archive bigfile '%s': not found", biggie_filename);
    2918 
     3069        mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
     3070        log_to_screen(tmp);
     3071        paranoid_free(tmp);
     3072
     3073        paranoid_free(checksum_line);
    29193074        mr_free(suffix);
    29203075        return (1);
     
    29393094        mr_asprintf(tmp, "%s", percent_media_full_comment());
    29403095        update_progress_form(tmp);
    2941         mr_free(tmp);
     3096        paranoid_free(tmp);
    29423097
    29433098        if (!(fout = fopen(curr_slice_fname_uncompressed, "w"))) {
     
    29463101            return (1);
    29473102        }
    2948         if ((i == bkpinfo->optimal_set_size / 256) && (totalread < 1.1 * totallength)) {
    2949             for (i = 0L; i < bkpinfo->optimal_set_size / 256; i++) {
     3103        if ((i == bkpinfo->optimal_set_size / 256)
     3104            && (totalread < 1.1 * totallength)) {
     3105            for (i = 0; i < bkpinfo->optimal_set_size / 256; i++) {
    29503106                blksize = fread(tempblock, 1, 256 * 1024, fin);
    29513107                if (blksize > 0) {
     
    29563112                }
    29573113            }
    2958             mr_free(tempblock);
    29593114        } else {
    2960             i = 0L;
     3115            i = 0;
    29613116        }
    29623117        paranoid_fclose(fout);
    2963         if (i > 0L)             // length_of_file (curr_slice_fname_uncompressed)
     3118        if (i > 0)              // length_of_file (curr_slice_fname_uncompressed)
    29643119        {
    29653120            if (!does_file_exist(curr_slice_fname_uncompressed)) {
    2966                 log_msg(2, "Warning - '%s' doesn't exist. How can I compress slice?", curr_slice_fname_uncompressed);
     3121                log_msg(2,
     3122                        "Warning - '%s' doesn't exist. How can I compress slice?",
     3123                        curr_slice_fname_uncompressed);
    29673124            }
    29683125            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
     
    29843141                log_msg(2, "Failed to compress the slice");
    29853142            }
    2986             if (bkpinfo->use_lzo && strcmp(curr_slice_fname_compressed, curr_slice_fname_uncompressed)) {
     3143            if (bkpinfo->use_lzo
     3144                && strcmp(curr_slice_fname_compressed,
     3145                          curr_slice_fname_uncompressed)) {
    29873146                unlink(curr_slice_fname_uncompressed);
    29883147            }
     
    29903149                mr_asprintf(tmp, "Problem with slice # %ld", slice_num);
    29913150            } else {
    2992                 mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1, slice_num);
     3151                mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1,
     3152                        slice_num);
    29933153            }
     3154#ifndef _XWIN
    29943155            if (!g_text_mode) {
    29953156                newtDrawRootText(0, g_noof_rows - 2, tmp);
     
    29983159                log_msg(2, tmp);
    29993160            }
    3000             mr_free(tmp);
     3161#else
     3162            log_msg(2, tmp);
     3163#endif
     3164            paranoid_free(tmp);
    30013165
    30023166            mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed);
     
    30143178
    30153179        if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    3016             register_in_tape_catalog(biggieslice, biggie_file_number, slice_num, file_to_archive);
    3017             maintain_collection_of_recent_archives(bkpinfo->tmpdir, file_to_archive);
     3180            register_in_tape_catalog(biggieslice, biggie_file_number,
     3181                                     slice_num, file_to_archive);
     3182            maintain_collection_of_recent_archives(bkpinfo->tmpdir,
     3183                                                   file_to_archive);
    30183184            res = move_files_to_stream(file_to_archive, NULL);
    30193185        } else {
     
    30243190        retval += res;
    30253191        if (res) {
    3026             log_to_screen("Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    3027             fatal_error("Hard disk full. You should have bought a bigger one.");
    3028         }
    3029     }
     3192            mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
     3193            log_to_screen(tmp);
     3194            paranoid_free(tmp);
     3195            fatal_error
     3196                ("Hard disk full. You should have bought a bigger one.");
     3197        }
     3198    }
     3199    mr_free(tempblock);
    30303200    mr_free(suffix);
    30313201    paranoid_fclose(fin);
     
    30373207    }
    30383208    log_msg(1, tmp);
    3039     mr_free(tmp);
    3040 
     3209    paranoid_free(tmp);
     3210
     3211    paranoid_free(checksum_line);
    30413212    return (retval);
    30423213}
     
    31173288    log_msg(2, tmp);
    31183289    center_string(tmp, 80);
     3290#ifndef _XWIN
    31193291    if (!g_text_mode) {
    31203292        newtPushHelpLine(tmp);
    31213293    }
     3294#endif
    31223295    res = write_iso_and_go_on(TRUE);
     3296#ifndef _XWIN
    31233297    if (!g_text_mode) {
    31243298        newtPopHelpLine();
    31253299    }
     3300#endif
    31263301    log_msg(2, "Returning from writing final ISO (res=%d)", res);
    31273302    paranoid_free(tmp);
     
    31523327
    31533328    /*@ buffers ***************************************************** */
    3154     char *tmp = NULL;
    3155     char *tmp1 = NULL;
    3156     char *cdno_fname = NULL;
    3157     char *lastcd_fname = NULL;
    3158     char *isofile = NULL;
     3329    char *tmp;
     3330    char *cdno_fname;
     3331    char *lastcd_fname;
     3332    char *isofile;
    31593333    char *mds = NULL;
    31603334
     
    31673341
    31683342    malloc_string(tmp);
     3343    malloc_string(cdno_fname);
     3344    malloc_string(lastcd_fname);
     3345    malloc_string(isofile);
    31693346
    31703347    assert(bkpinfo != NULL);
     
    31803357    /* label the ISO with its number */
    31813358
    3182     mr_asprintf(cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
     3359    sprintf(cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
    31833360    fout = fopen(cdno_fname, "w");
    3184     mr_free(cdno_fname);
    3185 
    31863361    fprintf(fout, "%d", g_current_media_number);
    31873362    paranoid_fclose(fout);
    31883363
    3189     mr_asprintf(tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);
    3190     if (run_program_and_log_output(tmp1, FALSE)) {
     3364    sprintf(tmp, "cp -f %s/autorun %s/", g_mondo_home,
     3365            bkpinfo->scratchdir);
     3366    if (run_program_and_log_output(tmp, FALSE)) {
    31913367        log_msg(2, "Warning - unable to copy autorun to scratchdir");
    31923368    }
    3193     mr_free(tmp1);
    31943369
    31953370    /* last CD or not? Label accordingly */
    3196     mr_asprintf(lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
     3371    sprintf(lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    31973372    if (last_cd) {
    31983373        unlink(lastcd_fname);
     
    32053380        paranoid_fclose(fout);
    32063381    }
    3207     mr_free(lastcd_fname);
    3208 
    32093382    if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 > bkpinfo->media_size) {
    3210         log_to_screen("Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",(long) space_occupied_by_cd(bkpinfo->scratchdir),(long) bkpinfo->media_size);
    3211     }
    3212     mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
     3383        sprintf(tmp,
     3384                "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.",
     3385                (long) space_occupied_by_cd(bkpinfo->scratchdir),
     3386                (long) bkpinfo->media_size);
     3387        log_to_screen(tmp);
     3388    }
     3389    sprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir,
    32133390            bkpinfo->netfs_remote_dir, bkpinfo->prefix,
    32143391            g_current_media_number);
     
    32253402            {
    32263403                log_msg(3, "*Sigh* Mike, I hate your computer.");
    3227                 // if it can't be found then force pausing
    32283404                bkpinfo->manual_cd_tray = TRUE;
    3229             } else {
     3405            }                   // if it can't be found then force pausing
     3406            else {
    32303407                log_msg(3, "Great. Found Mike's CD-ROM drive.");
    32313408            }
     
    32333410        if (bkpinfo->verify_data && !res) {
    32343411            mds = media_descriptor_string(g_backup_media_type);
    3235             log_to_screen("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
     3412            log_to_screen
     3413                ("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
    32363414            mr_free(mds);
    32373415            if (chdir("/")) {
     
    32503428        } else {
    32513429            mds = media_descriptor_string(bkpinfo->backup_media_type);
    3252             mr_asprintf(tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
     3430            sprintf(tmp, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
    32533431            mr_free(mds);
    3254             res = ask_me_yes_or_no(tmp1);
    3255             mr_free(tmp1);
    3256 
     3432            res = ask_me_yes_or_no(tmp);
    32573433            if (!res) {
    32583434                if (ask_me_yes_or_no("Abort the backup?")) {
     
    32673443        }
    32683444    }
    3269     mr_free(isofile);
    3270 
    32713445    g_current_media_number++;
    32723446    wipe_archives(bkpinfo->scratchdir);
    3273     mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
    3274     if (system(tmp1)) {
    3275         log_msg(2, "Error occurred when I tried to delete the redundant IMGs and GZs");
    3276     }
    3277     mr_free(tmp1);
     3447    sprintf(tmp, "rm -Rf %s/images/*gz %s/images/*data*img",
     3448            bkpinfo->scratchdir, bkpinfo->scratchdir);
     3449    if (system(tmp)) {
     3450        log_msg
     3451            (2,
     3452             "Error occurred when I tried to delete the redundant IMGs and GZs");
     3453    }
    32783454
    32793455    if (last_cd) {
     
    32853461    bkpinfo->verify_data = orig_vfy_flag_val;
    32863462    paranoid_free(tmp);
     3463    paranoid_free(cdno_fname);
     3464    paranoid_free(lastcd_fname);
     3465    paranoid_free(isofile);
    32873466    return (0);
    32883467}
     
    33533532            if (res) {
    33543533                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3355                 log_to_screen("Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3534                mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    33563535                mr_free(mds);
     3536                log_to_screen(tmp);
     3537                mr_free(tmp);
    33573538
    33583539            }
Note: See TracChangeset for help on using the changeset viewer.