Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (11 years ago)
Author:
Bruno Cornec
Message:

r3334@localhost: bruno | 2009-08-08 12:17:37 +0200

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
File:
1 edited

Legend:

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

    r2322 r2323  
    202202
    203203    if (!does_file_exist(filelist)) {
    204         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
     204        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
    205205        log_to_screen(tmp);
    206206        paranoid_free(tmp);
     
    208208    }
    209209
    210     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     210    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    211211    if (system(tmp)) {
    212212        paranoid_free(tmp);
     
    215215    paranoid_free(tmp);
    216216
    217     mr_asprintf(&command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",
     217    mr_asprintf(command, "star H=star list=%s -c " STAR_ACL_SZ " file=%s",
    218218            filelist, fname);
    219219    if (bkpinfo->use_lzo) {
     
    229229        log_msg(5, "command='%s'", command);
    230230        res = system(command);
    231         mr_asprintf(&tmp, "%s", last_line_of_file(MONDO_LOGFILE));
     231        mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE));
    232232        log_msg(1, "res=%d; tmp='%s'", res, tmp);
    233233        if (bkpinfo->use_star && (res == 254 || res == 65024)
     
    309309
    310310    if (!does_file_exist(filelist)) {
    311         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist",
     311        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist",
    312312                filelist);
    313313        log_to_screen(tmp);
     
    315315        return (1);
    316316    }
    317     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     317    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    318318    if (system(tmp)) {
    319319        paranoid_free(tmp);
     
    324324
    325325    if (bkpinfo->compression_level > 0) {
    326         mr_asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
     326        mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    327327        //       -b %ld, TAPE_BLOCK_SIZE
    328         mr_asprintf(&zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
     328        mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
    329329                bkpinfo->compression_level);
    330330        if (does_file_exist(tmp)) {
     
    335335        paranoid_free(tmp);
    336336    } else {
    337         mr_asprintf(&zipparams, "");
     337        mr_asprintf(zipparams, "");
    338338    }
    339339
     
    346346        fatal_error("scratchdir not found");
    347347    }
    348     mr_asprintf(&command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
     348    mr_asprintf(command, "rm -f %s %s. %s.gz %s.%s", fname, fname, fname,
    349349            fname, bkpinfo->zip_suffix);
    350350    paranoid_system(command);
    351351    paranoid_free(command);
    352352
    353     mr_asprintf(&command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
     353    mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s", TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    354354    paranoid_free(zipparams);
    355355
    356     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     356    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    357357    if (system(tmp)) {
    358358        paranoid_free(tmp);
     
    429429    }
    430430
    431     mr_asprintf(&tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
     431    mr_asprintf(tmp, "gzip -9 %s/archives/filelist.full", bkpinfo->scratchdir);
    432432    if (run_program_and_log_output(tmp, 2)) {
    433433        mr_free(tmp);
     
    436436    mr_free(tmp);
    437437
    438     mr_asprintf(&tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     438    mr_asprintf(tmp, "cp -f %s/archives/*list*.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
    439439    if (run_program_and_log_output(tmp, 2)) {
    440440        mr_free(tmp);
     
    461461    }
    462462    retval += do_that_initial_phase();  // prepare
    463     mr_asprintf(&tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
     463    mr_asprintf(tmp, "rm -f %s/images/*.iso", bkpinfo->scratchdir);
    464464    run_program_and_log_output(tmp, 1);
    465465    mr_free(tmp);
     
    541541    assert(bkpinfo != NULL);
    542542    if (bkpinfo->exclude_paths) {
    543         mr_asprintf(&tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);
    544         mr_asprintf(&devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
     543        mr_asprintf(tmp, "echo '%s' | tr -s ' ' '\n' | grep -E '^/dev/.*$' | tr -s '\n' ' ' | awk '{print $0\"\\n\";}'", bkpinfo->exclude_paths);
     544        mr_asprintf(devs_to_exclude, "%s", call_program_and_get_last_line_of_output(tmp));
    545545        mr_free(tmp);
    546546
    547         mr_asprintf(&tmp, "devs_to_exclude = '%s'", devs_to_exclude);
     547        mr_asprintf(tmp, "devs_to_exclude = '%s'", devs_to_exclude);
    548548        log_msg(2, tmp);
    549549        mr_free(tmp);
     
    552552    mvaddstr_and_log_it(g_currentY, 0,
    553553                        "Calling MINDI to create boot+data disks");
    554     mr_asprintf(&tmp, "%s/filelist.full", bkpinfo->tmpdir);
     554    mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir);
    555555    if (!does_file_exist(tmp)) {
    556556        mr_free(tmp);
    557         mr_asprintf(&tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     557        mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    558558        if (!does_file_exist(tmp)) {
    559559            fatal_error
     
    564564    mr_free(tmp);
    565565
    566     mr_asprintf(&tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    567     mr_asprintf(&last_filelist_number, "%s", last_line_of_file(tmp));
     566    mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
     567    mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp));
    568568    mr_free(tmp);
    569569
    570570    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    571         mr_asprintf(&tape_size_sz, "%ld", bkpinfo->media_size[1]);
     571        mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size[1]);
    572572        ntapedev = get_non_rewind_dev(bkpinfo->media_device);
    573573        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
     
    579579        }
    580580        paranoid_free(ntapedev);
    581         mr_asprintf(&tape_device, "%s", bkpinfo->media_device);
     581        mr_asprintf(tape_device, "%s", bkpinfo->media_device);
    582582    } else {
    583         mr_asprintf(&tape_size_sz, "%ld", 0L);;
    584         mr_asprintf(&tape_device, "");
     583        mr_asprintf(tape_size_sz, "%ld", 0L);;
     584        mr_asprintf(tape_device, "");
    585585    }
    586586    if (bkpinfo->use_lzo) {
    587         mr_asprintf(&use_lzo_sz, "yes");
     587        mr_asprintf(use_lzo_sz, "yes");
    588588    } else {
    589         mr_asprintf(&use_lzo_sz, "no");
     589        mr_asprintf(use_lzo_sz, "no");
    590590    }
    591591    if (bkpinfo->use_gzip) {
    592         mr_asprintf(&use_gzip_sz, "yes");
     592        mr_asprintf(use_gzip_sz, "yes");
    593593    } else {
    594         mr_asprintf(&use_gzip_sz, "no");
     594        mr_asprintf(use_gzip_sz, "no");
    595595    }
    596596    if (bkpinfo->use_star) {
    597         mr_asprintf(&use_star_sz, "yes");
     597        mr_asprintf(use_star_sz, "yes");
    598598    } else {
    599         mr_asprintf(&use_star_sz, "no");
     599        mr_asprintf(use_star_sz, "no");
    600600    }
    601601
    602602    if (bkpinfo->compression_level > 0) {
    603         mr_asprintf(&use_comp_sz, "yes");
     603        mr_asprintf(use_comp_sz, "yes");
    604604    } else {
    605         mr_asprintf(&use_comp_sz, "no");
    606     }
    607 
    608     mr_asprintf(&broken_bios_sz, "yes");    /* assume so */
     605        mr_asprintf(use_comp_sz, "no");
     606    }
     607
     608    mr_asprintf(broken_bios_sz, "yes"); /* assume so */
    609609    if (g_cd_recovery) {
    610         mr_asprintf(&cd_recovery_sz, "yes");
     610        mr_asprintf(cd_recovery_sz, "yes");
    611611    } else {
    612         mr_asprintf(&cd_recovery_sz, "no");
     612        mr_asprintf(cd_recovery_sz, "no");
    613613    }
    614614    if (bkpinfo->make_cd_use_lilo) {
    615         mr_asprintf(&use_lilo_sz, "yes");
     615        mr_asprintf(use_lilo_sz, "yes");
    616616    } else {
    617         mr_asprintf(&use_lilo_sz, "no");
     617        mr_asprintf(use_lilo_sz, "no");
    618618    }
    619619
     
    623623
    624624#ifdef __FreeBSD__
    625         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     625        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    626626               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    627627        if (!bootdev[0]) {
    628628            mr_free(bootdev);
    629             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     629            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    630630                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    631631        }
     
    633633        /* Linux */
    634634#ifdef __IA64__
    635         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     635        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    636636               ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    637637#else
    638         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     638        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    639639               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    640640#endif
     
    642642            mr_free(bootdev);
    643643#ifdef __IA64__
    644             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     644            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    645645                   ("mount | grep ' /boot/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    646646#else
    647             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     647            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    648648                   ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    649649#endif
     
    651651        if (!bootdev[0]) {
    652652            mr_free(bootdev);
    653             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     653            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    654654                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    655655            if (strstr(bootdev, "/dev/cciss/")) {
    656656                mr_free(bootdev);
    657                 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     657                mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    658658                       ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    659659            }
     
    666666            ch = 'U';
    667667        if (bkpinfo->boot_loader != '\0') {
    668             mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
     668            mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    669669            log_msg(2, tmp);
    670670            mr_free(tmp);
     
    673673        }
    674674        if (bkpinfo->boot_device[0] != '\0') {
    675             mr_asprintf(&tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
     675            mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    676676            log_msg(2, tmp);
    677677            mr_free(tmp);
     
    696696    }
    697697    if (bkpinfo->boot_loader == 'L') {
    698         mr_asprintf(&bootldr_str, "LILO");
     698        mr_asprintf(bootldr_str, "LILO");
    699699        if (!does_file_exist("/etc/lilo.conf")) {
    700700            fatal_error
     
    702702        }
    703703    } else if (bkpinfo->boot_loader == 'G') {
    704         mr_asprintf(&bootldr_str, "GRUB");
     704        mr_asprintf(bootldr_str, "GRUB");
    705705        if (!does_file_exist("/boot/grub/menu.lst")
    706706            && does_file_exist("/boot/grub/grub.conf")) {
     
    713713        }
    714714    } else if (bkpinfo->boot_loader == 'E') {
    715         mr_asprintf(&bootldr_str, "ELILO");
     715        mr_asprintf(bootldr_str, "ELILO");
    716716        /* BCO: fix it for Debian, Mandrake, ... */
    717717        if (!does_file_exist("/etc/elilo.conf")
     
    744744        }
    745745    } else if (bkpinfo->boot_loader == 'R') {
    746         mr_asprintf(&bootldr_str, "RAW");
     746        mr_asprintf(bootldr_str, "RAW");
    747747    }
    748748#ifdef __FreeBSD__
    749749    else if (bkpinfo->boot_loader == 'D') {
    750         mr_asprintf(&bootldr_str, "DD");
     750        mr_asprintf(bootldr_str, "DD");
    751751    }
    752752
    753753    else if (bkpinfo->boot_loader == 'B') {
    754         mr_asprintf(&bootldr_str, "BOOT0");
     754        mr_asprintf(bootldr_str, "BOOT0");
    755755    }
    756756#endif
    757757    else {
    758         mr_asprintf(&bootldr_str, "unknown");
    759     }
    760     mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
     758        mr_asprintf(bootldr_str, "unknown");
     759    }
     760    mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    761761    log_to_screen(tmp);
    762762    mr_free(tmp);
    763763
    764     mr_asprintf(&tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
     764    mr_asprintf(tmp, "%s/BOOTLOADER.DEVICE", bkpinfo->tmpdir);
    765765    if (write_one_liner_data_file(tmp, bkpinfo->boot_device)) {
    766766        log_msg(1, "%ld: Unable to write one-liner boot device", __LINE__);
     
    770770    switch (bkpinfo->backup_media_type) {
    771771    case cdr:
    772         mr_asprintf(&value, "cdr");
     772        mr_asprintf(value, "cdr");
    773773        break;
    774774    case cdrw:
    775         mr_asprintf(&value, "cdrw");
     775        mr_asprintf(value, "cdrw");
    776776        break;
    777777    case cdstream:
    778         mr_asprintf(&value, "cdstream");
     778        mr_asprintf(value, "cdstream");
    779779        break;
    780780    case tape:
    781         mr_asprintf(&value, "tape");
     781        mr_asprintf(value, "tape");
    782782        break;
    783783    case udev:
    784         mr_asprintf(&value, "udev");
     784        mr_asprintf(value, "udev");
    785785        break;
    786786    case iso:
    787         mr_asprintf(&value, "iso");
     787        mr_asprintf(value, "iso");
    788788        break;
    789789    case nfs:
    790         mr_asprintf(&value, "nfs");
     790        mr_asprintf(value, "nfs");
    791791        break;
    792792    case dvd:
    793         mr_asprintf(&value, "dvd");
     793        mr_asprintf(value, "dvd");
    794794        break;
    795795    case usb:
    796         mr_asprintf(&value, "usb");
     796        mr_asprintf(value, "usb");
    797797        break;
    798798    default:
     
    800800    }
    801801    if (bkpinfo->backup_media_type == usb) {
    802         mr_asprintf(&tmp2, "--usb %s", bkpinfo->media_device);
     802        mr_asprintf(tmp2, "--usb %s", bkpinfo->media_device);
    803803    } else {
    804         mr_asprintf(&tmp2," ");
    805     }
    806 
    807     mr_asprintf(&tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
     804        mr_asprintf(tmp2," ");
     805    }
     806
     807    mr_asprintf(tmp, "%s/BACKUP-MEDIA-TYPE", bkpinfo->tmpdir);
    808808    if (write_one_liner_data_file(tmp, value)) {
    809809        res++;
     
    814814    mr_free(tmp);
    815815
    816     mr_asprintf(&tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
     816    mr_asprintf(tmp, "%s/BOOTLOADER.NAME", bkpinfo->tmpdir);
    817817    if (write_one_liner_data_file(tmp, bootldr_str)) {
    818818        res++;
     
    823823    mr_free(tmp);
    824824
    825     mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
     825    mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    826826    if (bkpinfo->differential) {
    827827        res += write_one_liner_data_file(tmp, "1");
     
    832832
    833833    if (g_getfattr) {
    834         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
     834        mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir);
    835835        if (write_one_liner_data_file(tmp1, "TRUE")) {
    836836            log_msg(1, "%ld: Unable to write one-liner XATTR",
     
    840840    }
    841841    if (g_getfacl) {
    842         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
     842        mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir);
    843843        if (write_one_liner_data_file(tmp1, "TRUE")) {
    844844            log_msg(1, "%ld: Unable to write one-liner ACL",
     
    848848    }
    849849    if (bkpinfo->use_obdr) {
    850         mr_asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     850        mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir);
    851851        if (write_one_liner_data_file(tmp1, "TRUE")) {
    852852            log_msg(1, "%ld: Unable to write one-liner OBDR",
     
    859859        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    860860    /* add nfs stuff here? */
    861     mr_asprintf(&command, "mkdir -p %s/images", bkpinfo->scratchdir);
     861    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    862862    if (system(command)) {
    863863        res++;
     
    867867    log_msg(1, "lines_in_filelist = %ld", lines_in_filelist);
    868868
    869 /*     "mindi 1=%s --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
     869    mr_asprintf(command,
     870/*     "mindi --custom 2=%s 3=%s/images 4=\"%s\" 5=\"%s\" \
    8708716=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    87187211=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
     
    919920    if (!res) {
    920921        log_to_screen("Boot+data disks were created OK");
    921         mr_asprintf(&command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);
     922        mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso", bkpinfo->scratchdir, MINDI_CACHE);
    922923        log_msg(2, command);
    923924        run_program_and_log_output(command, FALSE);
     
    925926
    926927        if (bkpinfo->nonbootable_backup) {
    927             mr_asprintf(&command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
     928            mr_asprintf(command, "cp -f %s/all.tar.gz %s/images", bkpinfo->tmpdir, bkpinfo->scratchdir);
    928929            if (system(command)) {
    929930                paranoid_free(command);
     
    934935        /* For USB we already have everything on the key */
    935936        if (bkpinfo->backup_media_type == usb) {
    936             mr_asprintf(&command, "rm -rf %s/images", bkpinfo->scratchdir);
     937            mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir);
    937938            run_program_and_log_output(command, FALSE);
    938939            paranoid_free(command);
    939940        } else {
    940             mr_asprintf(&tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
     941            mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir, bkpinfo->tmpdir);
    941942            if (system(tmp)) {
    942943                fatal_error("Cannot find all.tar.gz in tmpdir");
     
    951952    } else {
    952953        log_to_screen("Mindi failed to create your boot+data disks.");
    953         mr_asprintf(&command, "grep 'Fatal error' /var/log/mindi.log");
    954         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     954        mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
     955        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    955956        paranoid_free(command);
    956957
     
    10581059        }
    10591060
    1060         mr_asprintf(&tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
     1061        mr_asprintf(tmp, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no - ARCH_BUFFER_NUM, bkpinfo->zip_suffix);
    10611062        if (does_file_exist(tmp)) {
    10621063            log_msg(4, "%s[%d:%d] - waiting for storer", FORTY_SPACES,
     
    10721073                this_thread_no, archiving_set_no);
    10731074        if (g_getfattr) {
    1074             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1075            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10751076            get_fattr_list(archiving_filelist_fname, curr_xattr_list_fname);
    10761077            mr_free(curr_xattr_list_fname);
    10771078        }
    10781079        if (g_getfacl) {
    1079             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
     1080            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, archiving_set_no);
    10801081            get_acl_list(archiving_filelist_fname, curr_acl_list_fname);
    10811082            mr_free(curr_acl_list_fname);
     
    10911092
    10921093        if (res) {
    1093             mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
     1094            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Please review logs.", archiving_set_no);
    10941095            log_to_screen(tmp);
    10951096            mr_free(tmp);
     
    12091210
    12101211    assert(bkpinfo != NULL);
    1211     mr_asprintf(&data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
    1212 
    1213     mr_asprintf(&g_serial_string, "%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"));
     1212    mr_asprintf(data_disks_file, "%s/all.tar.gz", bkpinfo->tmpdir);
     1213
     1214    mr_asprintf(g_serial_string, "%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"));
    12141215    mr_strip_spaces(g_serial_string);
    12151216    mr_strcat(g_serial_string, "...word.");
    12161217    log_msg(2, "g_serial_string = '%s'", g_serial_string);
    12171218
    1218     mr_asprintf(&tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
     1219    mr_asprintf(tmpfile, "%s/archives/SERIAL-STRING", bkpinfo->scratchdir);
    12191220    if (write_one_liner_data_file(tmpfile, g_serial_string)) {
    12201221        log_msg(1, "%ld: Failed to write serial string", __LINE__);
     
    12431244    mr_free(data_disks_file);
    12441245
    1245     mr_asprintf(&command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
     1246    mr_asprintf(command, "rm -f %s/%s/%s-[1-9]*.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix);
    12461247    paranoid_system(command);
    12471248    mr_free(command);
     
    14091410            } else {
    14101411                // store set N
    1411                 mr_asprintf(&storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    1412                 mr_asprintf(&storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
     1412                mr_asprintf(storing_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1413                mr_asprintf(storing_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no, bkpinfo->zip_suffix);
    14131414                if (g_getfattr) {
    1414                     mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1415                    mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    14151416                }
    14161417                if (g_getfacl) {
    1417                     mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
     1418                    mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, storing_set_no);
    14181419                }
    14191420
     
    14691470                mr_free(media_usage_comment);
    14701471                if (res) {
    1471                     mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);
     1472                    mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", storing_set_no);
    14721473                    log_to_screen(tmp);
    14731474                    paranoid_free(tmp);
     
    14891490    close_progress_form();
    14901491
    1491     mr_asprintf(&tmp, "Your regular files have been archived ");
     1492    mr_asprintf(tmp, "Your regular files have been archived ");
    14921493    log_msg(2, "Joining background threads to foreground thread");
    14931494    for (i = 0; i < noof_threads; i++) {
     
    15551556    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
    15561557    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1557     mr_asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1558    mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir);
    15581559    run_program_and_log_output(tmp, FALSE);
    15591560    paranoid_free(tmp);
     
    15611562
    15621563    mds = media_descriptor_string(bkpinfo->backup_media_type);
    1563     mr_asprintf(&message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
     1564    mr_asprintf(message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
    15641565    mr_free(mds);
    15651566    log_msg(1, message_to_screen);
    15661567
    1567     mr_asprintf(&tmp1, "%s1", bkpinfo->media_device);
     1568    mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
    15681569    if (is_this_device_mounted(tmp1)) {
    15691570        log_msg(1, "USB device mounted. Remounting it at the right place");
    1570         mr_asprintf(&tmp, "umount %s", tmp1);
     1571        mr_asprintf(tmp, "umount %s", tmp1);
    15711572        run_program_and_log_output(tmp, FALSE);
    15721573        paranoid_free(tmp);
     
    15751576
    15761577    log_msg(1, "Mounting USB device.");
    1577     mr_asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
    1578     mr_asprintf(&tmp, "mkdir -p %s", tmp1);
     1578    mr_asprintf(tmp1, "%s/usb", bkpinfo->tmpdir);
     1579    mr_asprintf(tmp, "mkdir -p %s", tmp1);
    15791580    run_program_and_log_output(tmp, FALSE);
    15801581    paranoid_free(tmp);
    15811582    /* Mindi always create one single parition on the USB dev */
    1582     mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
     1583    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    15831584    run_program_and_log_output(tmp, FALSE);
    15841585    paranoid_free(tmp);
     
    15901591
    15911592        /* Command to execute */
    1592         mr_asprintf(&tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
     1593        mr_asprintf(tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
    15931594        res = eval_call_to_make_USB(tmp, message_to_screen);
    15941595        if (res) {
    1595             mr_asprintf(&result_sz, "%s ...failed",tmp);
     1596            mr_asprintf(result_sz, "%s ...failed",tmp);
    15961597        } else {
    1597             mr_asprintf(&result_sz, "%s ...OK",tmp);
     1598            mr_asprintf(result_sz, "%s ...OK",tmp);
    15981599        }
    15991600        log_to_screen(result_sz);
     
    16031604
    16041605        /* Recreate the required structure under the scratch dir */
    1605         mr_asprintf(&tmp,"mkdir %s/archive", bkpinfo->scratchdir);
     1606        mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    16061607        run_program_and_log_output(tmp, FALSE);
    16071608        paranoid_free(tmp);
     
    16111612
    16121613    if (is_this_device_mounted(bkpinfo->media_device)) {
    1613         mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     1614        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    16141615        run_program_and_log_output(tmp, FALSE);
    16151616        paranoid_free(tmp);
     
    16651666    assert_string_is_neither_NULL_nor_zerolength(destfile);
    16661667
    1667     mr_asprintf(&tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
    1668     mr_asprintf(&tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
     1668    mr_asprintf(tmp, "%s/isolinux.bin", bkpinfo->scratchdir);
     1669    mr_asprintf(tmp2, "%s/isolinux.bin", bkpinfo->tmpdir);
    16691670    if (does_file_exist(tmp)) {
    1670         mr_asprintf(&tmp3, "cp -f %s %s", tmp, tmp2);
     1671        mr_asprintf(tmp3, "cp -f %s %s", tmp, tmp2);
    16711672        paranoid_system(tmp3);
    16721673        mr_free(tmp3);
    16731674    }
    16741675    if (!does_file_exist(tmp) && does_file_exist(tmp2)) {
    1675         mr_asprintf(&tmp3, "cp -f %s %s", tmp2, tmp);
     1676        mr_asprintf(tmp3, "cp -f %s %s", tmp2, tmp);
    16761677        paranoid_system(tmp3);
    16771678        mr_free(tmp3);
     
    16861687    log_msg(2, "make_iso_fs --- scratchdir=%s --- destfile=%s", bkpinfo->scratchdir, destfile);
    16871688    (void) getcwd(old_pwd, MAX_STR_LEN - 1);
    1688     mr_asprintf(&tmp, "chmod 755 %s", bkpinfo->scratchdir);
     1689    mr_asprintf(tmp, "chmod 755 %s", bkpinfo->scratchdir);
    16891690    run_program_and_log_output(tmp, FALSE);
    16901691    mr_free(tmp);
     
    16931694
    16941695    if (bkpinfo->call_before_iso[0] != '\0') {
    1695         mr_asprintf(&message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
     1696        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d", g_current_media_number);
    16961697        res =
    16971698            eval_call_to_make_ISO(bkpinfo->call_before_iso,
     
    17121713        log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);
    17131714        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1714         mr_asprintf(&message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
     1715        mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
    17151716        mr_free(mds);
    17161717
     
    17261727            } else {
    17271728                log_to_screen("%s...OK", message_to_screen);
    1728                 mr_asprintf(&tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
     1729                mr_asprintf(tmp, "tail -n10 %s | grep -F ':-('", MONDO_LOGFILE);
    17291730                if (!run_program_and_log_output(tmp, 1)) {
    17301731                    log_to_screen
     
    17351736            retval += res;
    17361737#ifdef DVDRWFORMAT
    1737             mr_asprintf(&tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
     1738            mr_asprintf(tmp, "tail -n8 %s | grep 'blank=full.*dvd-compat.*DAO'", MONDO_LOGFILE);
    17381739            if (g_backup_media_type == dvd
    17391740                && (res || !run_program_and_log_output(tmp, 1))) {
     
    17511752                }
    17521753                pause_for_N_seconds(5, "Letting DVD drive settle");
    1753                 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
     1754                mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    17541755                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    17551756                res =
     
    18021803    } else {
    18031804        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1804         mr_asprintf(&message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
     1805        mr_asprintf(message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
    18051806        log_msg(1, message_to_screen);
    1806         mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
     1807        mr_asprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
    18071808        mr_free(mds);
    18081809        if (bkpinfo->nonbootable_backup) {
     
    18741875                    "Warning - %s mounted. I'm unmounting it before I burn to it.",
    18751876                    bkpinfo->media_device);
    1876             mr_asprintf(&tmp, "umount %s", bkpinfo->media_device);
     1877            mr_asprintf(tmp, "umount %s", bkpinfo->media_device);
    18771878            run_program_and_log_output(tmp, FALSE);
    18781879            mr_free(tmp);
     
    18831884        log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);
    18841885        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1885         mr_asprintf(&message_to_screen, "Burning %s #%d", mds, g_current_media_number);
     1886        mr_asprintf(message_to_screen, "Burning %s #%d", mds, g_current_media_number);
    18861887        mr_free(mds);
    18871888        pause_and_ask_for_cdr(2, &cd_is_mountable);
     
    19031904    if (bkpinfo->call_after_iso[0] != '\0') {
    19041905        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1905         mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
     1906        mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
    19061907        mr_free(mds);
    19071908        res =
     
    19361937    bool ret = TRUE;
    19371938
    1938     mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
     1939    mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
    19391940    log_msg(1, "command = '%s'", command);
    1940     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1941    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19411942    mr_free(command);
    19421943
     
    20112012        return (0);
    20122013    }
    2013     mr_asprintf(&tmp, "I am now backing up all large files.");
     2014    mr_asprintf(tmp, "I am now backing up all large files.");
    20142015    log_to_screen(tmp);
    20152016    noof_biggie_files = count_lines_in_file(biggielist_fname);
     
    20552056                        "Calling ntfsclone in background because %s is an NTFS partition",
    20562057                        bigfile_fname);
    2057                 mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
     2058                mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
    20582059                mkfifo(sz_devfile, 0x770);
    20592060                ntfsprog_fifo = sz_devfile;
     
    21092110                p = bigfile_fname;
    21102111            }
    2111             mr_asprintf(&tmp, "Archiving %s ... ", bigfile_fname);
     2112            mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname);
    21122113            if (res) {
    21132114                mr_strcat(tmp, "Failed!");
     
    21702171    for (; does_file_exist(curr_filelist_fname); curr_set_no++) {
    21712172        /* backup this set of files */
    2172         mr_asprintf(&curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2173        mr_asprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21732174        if (! does_file_exist(curr_filelist_fname)) {
    21742175            mr_free(curr_filelist_fname);
     
    21762177        }
    21772178
    2178         mr_asprintf(&curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
     2179        mr_asprintf(curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
    21792180
    21802181        log_msg(1, "EXAT'g set %ld", curr_set_no);
    21812182        if (g_getfattr) {
    2182             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2183            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21832184            get_fattr_list(curr_filelist_fname, curr_xattr_list_fname);
    21842185        }
    21852186        if (g_getfacl) {
    2186             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2187            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    21872188            get_acl_list(curr_filelist_fname, curr_acl_list_fname);
    21882189        }
     
    21942195        retval += res;
    21952196        if (res) {
    2196             mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
     2197            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    21972198            log_to_screen(tmp);
    21982199            mr_free(tmp);
     
    22462247
    22472248        if (res) {
    2248             mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
     2249            mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    22492250            log_to_screen(tmp);
    22502251            mr_free(tmp);
     
    22562257    }
    22572258    close_progress_form();
    2258     mr_asprintf(&tmp, "Your regular files have been archived ");
     2259    mr_asprintf(tmp, "Your regular files have been archived ");
    22592260    if (retval) {
    22602261        mr_strcat(tmp, "(with errors).");
     
    23422343    mvaddstr_and_log_it(g_currentY, 0,
    23432344                        "Archiving large files to media           ");
    2344     mr_asprintf(&biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
     2345    mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
    23452346    if (g_getfattr) {
    2346         mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2347        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    23472348    }
    23482349    if (g_getfacl) {
    2349         mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2350     }
    2351 
    2352     mr_asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
     2350        mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2351    }
     2352
     2353    mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
    23532354            biggielist);
    23542355    paranoid_system(command);
    23552356    mr_free(command);
    23562357
    2357     mr_asprintf(&blah, "biggielist = %s", biggielist);
     2358    mr_asprintf(blah, "biggielist = %s", biggielist);
    23582359    log_msg(2, blah);
    23592360    mr_free(blah);
     
    23652366    if (g_getfattr) {
    23662367        get_fattr_list(biggielist, xattr_fname);
    2367         mr_asprintf(&command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);
     2368        mr_asprintf(command, "cp %s %s/archives/", xattr_fname, bkpinfo->scratchdir);
    23682369        paranoid_system(command);
    23692370        mr_free(command);
     
    23712372    if (g_getfacl) {
    23722373        get_acl_list(biggielist, acl_fname);
    2373         mr_asprintf(&command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
     2374        mr_asprintf(command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
    23742375        paranoid_system(command);
    23752376        mr_free(command);
     
    23782379    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    23792380        res += write_EXAT_files_to_tape(xattr_fname, acl_fname);
    2380         mr_asprintf(&blah, "%ld", count_lines_in_file(biggielist));
     2381        mr_asprintf(blah, "%ld", count_lines_in_file(biggielist));
    23812382        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    23822383        mr_free(blah);
     
    24542455            continue;
    24552456        }
    2456         mr_asprintf(&curr_file, "%s", cf);
     2457        mr_asprintf(curr_file, "%s", cf);
    24572458        if (!does_file_exist(curr_file)) {
    24582459            log_msg(1,
     
    24832484            continue;
    24842485        }
    2485         mr_asprintf(&curr_file, "%s", cf);
    2486 
    2487         mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
     2486        mr_asprintf(curr_file, "%s", cf);
     2487
     2488        mr_asprintf(tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
    24882489        mr_free(curr_file);
    24892490        res = run_program_and_log_output(tmp, 5);
     
    25582559            continue;
    25592560        }
    2560         mr_asprintf(&curr_file, "%s", cf);
     2561        mr_asprintf(curr_file, "%s", cf);
    25612562        if (!does_file_exist(curr_file)) {
    25622563            log_msg(1,
     
    26162617    char *cdrecord = NULL;
    26172618
    2618     mr_asprintf(&bkp, "%s", cdrw_dev);
     2619    mr_asprintf(bkp, "%s", cdrw_dev);
    26192620    if (find_cdrw_device(cdrw_dev)) {
    26202621        strcpy(cdrw_dev, bkp);
    26212622    } else {
    26222623        if (!system("which cdrecord > /dev/null 2> /dev/null")) {
    2623             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2624            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26242625        } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) {
    2625             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2626            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26262627        } else {
    26272628            log_msg(2, "Oh well. I guess I'll just pray then.");
     
    26812682
    26822683    mds = media_descriptor_string(g_backup_media_type);
    2683     mr_asprintf(&tmp, "I am about to burn %s #%d", mds, g_current_media_number);
     2684    mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number);
    26842685    mr_free(mds);
    26852686    log_to_screen(tmp);
     
    26992700      retract_CD_tray_and_defeat_autorun();
    27002701*/
    2701         mr_asprintf(&tmp, "umount %s", cdrom_dev);
     2702        mr_asprintf(tmp, "umount %s", cdrom_dev);
    27022703        run_program_and_log_output(tmp, 1);
    27032704        sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
     
    27052706        sprintf(szunmount, "umount %s", mtpt);
    27062707        cd_number = -1;
    2707         mr_asprintf(&tmp, "mount %s %s", cdrom_dev, mtpt);
    2708         mr_asprintf(&our_serial_str, "%s", "");
     2708        mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt);
     2709        mr_asprintf(our_serial_str, "%s", "");
    27092710        attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1);
    27102711        mr_free(tmp);
     
    27352736
    27362737            cd_number = atoi(last_line_of_file(szcdno));
    2737             mr_asprintf(&tmp, "cat %s 2> /dev/null", szserfname);
     2738            mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname);
    27382739            mr_free(our_serial_str);
    2739             mr_asprintf(&our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));
     2740            mr_asprintf(our_serial_str, "%s", call_program_and_get_last_line_of_output(tmp));
    27402741            mr_free(tmp);
    27412742            // FIXME - should be able to use last_line_of_file(), surely?
     
    27732774        eject_device(cdrom_dev);
    27742775        mds = media_descriptor_string(g_backup_media_type);
    2775         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);
     2776        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);
    27762777        mr_free(mds);
    27772778
     
    29182919    if (is_this_file_compressed(biggie_filename)
    29192920        || bkpinfo->compression_level == 0) {
    2920         mr_asprintf(&suffix, "%s", "");
     2921        mr_asprintf(suffix, "%s", "");
    29212922        //      log_it("%s is indeed compressed :-)", filename);
    29222923        should_I_compress_slices = FALSE;
    29232924    } else {
    2924         mr_asprintf(&suffix, "%s", bkpinfo->zip_suffix);
     2925        mr_asprintf(suffix, "%s", bkpinfo->zip_suffix);
    29252926        should_I_compress_slices = TRUE;
    29262927    }
     
    29382939            fatal_error("ntfsresize not found");
    29392940        }
    2940         mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
     2941        mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
    29412942        log_it("command = %s", command);
    2942         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2943        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    29432944        mr_free(command);
    29442945        log_it("res of it = %s", tmp);
     
    29482949        file_to_openin = biggie_filename;
    29492950        if (strchr(biggie_filename,'\'') != NULL) {
    2950             mr_asprintf(&command, "md5sum \"%s\"", biggie_filename);
     2951            mr_asprintf(command, "md5sum \"%s\"", biggie_filename);
    29512952        } else {
    2952             mr_asprintf(&command, "md5sum '%s'", biggie_filename);
     2953            mr_asprintf(command, "md5sum '%s'", biggie_filename);
    29532954        }
    29542955        if (!(fin = popen(command, "r"))) {
     
    29732974    strcpy(biggiestruct.checksum, checksum_line);
    29742975
    2975     mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     2976    mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
    29762977    fout = fopen(tmp, "w");
    29772978    if (fout == NULL) {
     
    29922993    if (!(fin = fopen(file_to_openin, "r"))) {
    29932994        log_OS_error("Unable to openin biggie_filename");
    2994         mr_asprintf(&tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
     2995        mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
    29952996        log_to_screen(tmp);
    29962997        paranoid_free(tmp);
     
    30143015    }
    30153016    for (slice_num = 1; !finished; slice_num++) {
    3016         mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
    3017         mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3017        mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     3018        mr_asprintf(curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
    30183019
    30193020       
     
    30503051            }
    30513052            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
    3052                 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
     3053                mr_asprintf(command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
    30533054                log_msg(2, command);
    30543055                if ((res = system(command))) {
     
    30573058                //          did_I_compress_slice = TRUE;
    30583059            } else {
    3059                 mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
     3060                mr_asprintf(command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
    30603061                res = 0;        // don't do it :)
    30613062                //          did_I_compress_slice = FALSE;
     
    30733074            }
    30743075            if (res) {
    3075                 mr_asprintf(&tmp, "Problem with slice # %ld", slice_num);
     3076                mr_asprintf(tmp, "Problem with slice # %ld", slice_num);
    30763077            } else {
    3077                 mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1, slice_num);
     3078                mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1, slice_num);
    30783079            }
    30793080#ifndef _XWIN
     
    30893090            paranoid_free(tmp);
    30903091
    3091             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed);
     3092            mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed);
    30923093            g_current_progress++;
    30933094        } else {                /* if i==0 then ... */
    30943095
    30953096            finished = TRUE;
    3096             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed);
     3097            mr_asprintf(file_to_archive, "%s", curr_slice_fname_uncompressed);
    30973098            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    30983099                break;
     
    31143115        retval += res;
    31153116        if (res) {
    3116             mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
     3117            mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    31173118            log_to_screen(tmp);
    31183119            paranoid_free(tmp);
     
    31243125    mr_free(suffix);
    31253126    paranoid_fclose(fin);
    3126     mr_asprintf(&tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
     3127    mr_asprintf(tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
    31273128    if (retval) {
    31283129        mr_strcat(tmp, "...FAILED");
     
    31583159    assert_string_is_neither_NULL_nor_zerolength(d);
    31593160
    3160     mr_asprintf(&dir, "%s/archives", d);
    3161     mr_asprintf(&tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
     3161    mr_asprintf(dir, "%s/archives", d);
     3162    mr_asprintf(tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
    31623163    run_program_and_log_output(tmp, FALSE);
    31633164    mr_free(tmp);
    3164     mr_asprintf(&tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
     3165    mr_asprintf(tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
    31653166    run_program_and_log_output(tmp, FALSE);
    31663167    mr_free(tmp);
    3167     mr_asprintf(&tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
     3168    mr_asprintf(tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
    31683169    run_program_and_log_output(tmp, FALSE);
    31693170    mr_free(tmp);
    3170     mr_asprintf(&tmp, "rm -f %s/cklist*", dir);
     3171    mr_asprintf(tmp, "rm -f %s/cklist*", dir);
    31713172    run_program_and_log_output(tmp, FALSE);
    31723173    mr_free(tmp);
    3173     mr_asprintf(&tmp, "rm -f %s/zero", dir);
     3174    mr_asprintf(tmp, "rm -f %s/zero", dir);
    31743175    run_program_and_log_output(tmp, FALSE);
    31753176    mr_free(tmp);
    31763177    log_msg(1, "Wiped %s's archives", dir);
    3177     mr_asprintf(&tmp, "ls -l %s", dir);
     3178    mr_asprintf(tmp, "ls -l %s", dir);
    31783179    mr_free(dir);
    31793180    run_program_and_log_output(tmp, FALSE);
     
    32803281    /* label the ISO with its number */
    32813282
    3282     mr_asprintf(&cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
     3283    mr_asprintf(cdno_fname, "%s/archives/THIS-CD-NUMBER", bkpinfo->scratchdir);
    32833284    fout = fopen(cdno_fname, "w");
    32843285    mr_free(cdno_fname);
     
    32873288    paranoid_fclose(fout);
    32883289
    3289     mr_asprintf(&tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);
     3290    mr_asprintf(tmp1, "cp -f %s/autorun %s/", g_mondo_home, bkpinfo->scratchdir);
    32903291    if (run_program_and_log_output(tmp1, FALSE)) {
    32913292        log_msg(2, "Warning - unable to copy autorun to scratchdir");
     
    32943295
    32953296    /* last CD or not? Label accordingly */
    3296     mr_asprintf(&lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
     3297    mr_asprintf(lastcd_fname, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    32973298    if (last_cd) {
    32983299        unlink(lastcd_fname);
     
    33093310    if (space_occupied_by_cd(bkpinfo->scratchdir) / 1024 >
    33103311        bkpinfo->media_size[g_current_media_number]) {
    3311         mr_asprintf(&tmp1, "Warning! CD is too big. It occupies %ld KB, which is more than the %ld KB allowed.", (long) space_occupied_by_cd(bkpinfo->scratchdir),
    3312                 (long) bkpinfo->media_size[g_current_media_number]);
     3312        mr_asprintf(tmp1, "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[g_current_media_number]);
    33133313        log_to_screen(tmp1);
    33143314        mr_free(tmp1);
    33153315    }
    3316     mr_asprintf(&isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     3316    mr_asprintf(isofile, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    33173317    for (that_one_was_ok = FALSE; !that_one_was_ok;) {
    33183318        if (bkpinfo->backup_media_type != usb) {
     
    33513351        } else {
    33523352            mds = media_descriptor_string(bkpinfo->backup_media_type);
    3353             mr_asprintf(&tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
     3353            mr_asprintf(tmp1, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
    33543354            mr_free(mds);
    33553355            res = ask_me_yes_or_no(tmp1);
     
    33753375    }
    33763376    wipe_archives(bkpinfo->scratchdir);
    3377     mr_asprintf(&tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
     3377    mr_asprintf(tmp1, "rm -Rf %s/images/*gz %s/images/*data*img", bkpinfo->scratchdir, bkpinfo->scratchdir);
    33783378    if (system(tmp1)) {
    33793379        log_msg
     
    34323432        log_msg(2,
    34333433                "Not verifying again. Per-CD/ISO verification already carried out.");
    3434         mr_asprintf(&tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
     3434        mr_asprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
    34353435        paranoid_system(tmp);
    34363436        mr_free(tmp);
     
    34553455            if (res) {
    34563456                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3457                 mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3457                mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    34583458                mr_free(mds);
    34593459                log_to_screen(tmp);
     
    34623462            }
    34633463        }
    3464         mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3464        mr_asprintf(tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    34653465        (void)system(tmp);
    34663466        mr_free(tmp);
    34673467
    3468         mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3468        mr_asprintf(tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    34693469        (void)system(tmp);
    34703470        mr_free(tmp);
     
    34753475//}
    34763476    }
    3477     mr_asprintf(&tmp, "%s/changed.files", MONDO_CACHE);
     3477    mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE);
    34783478    diffs = count_lines_in_file(tmp);
    34793479    mr_free(tmp);
Note: See TracChangeset for help on using the changeset viewer.