Changeset 2323 in MondoRescue


Ignore:
Timestamp:
Aug 18, 2009, 3:05:43 PM (15 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)
Location:
branches/2.2.10/mondo
Files:
25 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);
  • branches/2.2.10/mondo/src/common/libmondo-cli.c

    r2322 r2323  
    111111    for (i = 0; i < 128; i++) {
    112112        if (flag_set[i]) {
    113             mr_asprintf(&tmp, "-%c %s", i, flag_val[i]);
     113            mr_asprintf(tmp, "-%c %s", i, flag_val[i]);
    114114            log_msg(3, tmp);
    115115            mr_free(tmp);
    116116        }
    117117    }
    118     mr_asprintf(&tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
     118    mr_asprintf(tmp, "rm -Rf %s/tmp.mondo.*", bkpinfo->tmpdir);
    119119    paranoid_system(tmp);
    120120    mr_free(tmp);
    121121
    122     mr_asprintf(&tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);
     122    mr_asprintf(tmp, "rm -Rf %s/mondo.scratch.*", bkpinfo->scratchdir);
    123123    paranoid_system(tmp);
    124124    mr_free(tmp);
     
    126126    mr_strcat(bkpinfo->scratchdir, "/mondo.scratch.%ld", random() % 32767);
    127127
    128     mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
     128    mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
    129129    paranoid_system(tmp);
    130130    mr_free(tmp);
    131131
    132     mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->scratchdir);
     132    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir);
    133133    paranoid_system(tmp);
    134134    mr_free(tmp);
     
    161161        *(strchr(tmp, ',')) = '\0';
    162162        bkpinfo->media_size[j] = friendly_sizestr_to_sizelong(tmp);
    163         mr_asprintf(&comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
     163        mr_asprintf(comment, "media_size[%d] = %ld", j, bkpinfo->media_size[j]);
    164164        log_msg(3, comment);
    165165        mr_free(comment);
     
    279279    ********/
    280280    /* Get the number of mounted file systems ((those that start with "/dev/" */
    281     mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
     281    mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
    282282    log_msg(5, "Running: %s", command);
    283     mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     283    mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    284284    mr_free(command);
    285285
     
    289289
    290290    for (i=mount_cnt; i > 0; i--) {
    291         mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
     291        mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
    292292        log_msg(5, "Running: %s", command);
    293         mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     293        mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    294294        mr_free(command);
    295295
     
    373373    log_msg(5, "  %s looks like a device special file", dsf);
    374374    /* Verify that the dsf exists */
    375     mr_asprintf(&command, "ls -al %s 2>/dev/null | wc -l", dsf);
     375    mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf);
    376376    log_msg(5, "  Executing: %s", command);
    377     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     377    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    378378    mr_free(command);
    379379
     
    399399    * Either way, it's an error.
    400400    ********/
    401     mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     401    mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    402402    log_msg(4, "Executing: %s", command);
    403     mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     403    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
    404404    mr_free(command);
    405405    log_msg(4, "Partition list for %s: %s", dsf, partition_list);
     
    452452        log_msg(4, "Processing partition: %s", partitions[i]);
    453453        /* See if it's swap. If it is, ignore it. */
    454         mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     454        mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    455455          dsf, partitions[i]);
    456456        log_msg(4, "  Running: %s", command);
    457         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     457        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    458458        mr_free(command);
    459459
     
    467467        }
    468468        /* It's not swap. See if we can find the mount point from the mount command. */
    469         mr_asprintf(&command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
    470         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     469        mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
     470        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    471471        mr_free(command);
    472472
     
    486486        log_msg(4, "  It's not mounted. Checking to see if it's LVM...");
    487487        /* Get the partition ID; 8e for LVM */
    488         mr_asprintf(&command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);
     488        mr_asprintf(command, "parted2fdisk -l %s |awk '{if($1 ~ \"^%s\"){print $5}}'", dsf, partitions[i]);
    489489        log_msg(4, "  Running: %s", command);
    490         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     490        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    491491        mr_free(command);
    492492        if (strlen(tmp)) {
     
    495495                /* It's LVM: Find the VG it's in */
    496496                log_msg(4, "  It's LVM: Find the VG it's in...");
    497                 mr_asprintf(&command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
     497                mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
    498498                log_msg(4, "  Running: %s", command);
    499499                strcpy(VG, call_program_and_get_last_line_of_output(command));
     
    503503                    /* Found the Volume Group. Now find all of the VG's mount points */
    504504                    log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    505                     mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
     505                    mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s-|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    506506                    log_msg(4, "  Running: %s", command);
    507                     mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     507                    mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    508508                    mr_free(command);
    509509                    log_msg(4, "  VG %s mount_list: %s", VG, mount_list);
     
    525525                     *******/
    526526                    mr_free(mount_list);
    527                     mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     527                    mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    528528                    log_msg (5, "Running: %s", command);
    529                     mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     529                    mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    530530                    mr_free(command);
    531531                    log_msg(4, "  Software raid device list: %s", mount_list);
    532532                    lastpos = 0;
    533533                    while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    534                         mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
     534                        mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    535535                        log_msg (5, "Running: %s", command);
    536536                        mr_free(tmp);
    537                         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     537                        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    538538                        mr_free(command);
    539539                        log_msg(4, "Number of Software raid device: %s", tmp);
     
    567567         ********/
    568568        log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device.");
    569         mr_asprintf(&command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
     569        mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
    570570        log_msg(4, "  Running: %s", command);
    571         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     571        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    572572        mr_free(command);
    573573        if (!strlen(tmp)) {
     
    578578        log_msg (5, "  UUID: %s", tmp);
    579579        /* Get the Software raid device list */
    580         mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     580        mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    581581        log_msg (5, "  Running: %s", command);
    582         mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     582        mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    583583        mr_free(command);
    584584        log_msg(4, "  Software raid device list: %s", mount_list);
     
    586586        lastpos = 0;
    587587        while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    588             mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
     588            mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
    589589            log_msg(4, "  Running: %s", command);
    590590            mr_free(tmp);
    591             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     591            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    592592            mr_free(command);
    593593            if (!atoi(tmp)) {
     
    760760        }
    761761
    762         mr_asprintf(&tmp1, "%s", flag_val['I']);
     762        mr_asprintf(tmp1, "%s", flag_val['I']);
    763763        p = tmp1;
    764764        q = tmp1;
     
    797797                log_to_screen("Archiving only the following file systems on %s:\n", token);
    798798                log_to_screen("  %s\n", mounted_on_dsf);
    799                 mr_asprintf(&p, "/");
     799                mr_asprintf(p, "/");
    800800                mr_free(bkpinfo->include_paths);
    801801                bkpinfo->include_paths = p;
     
    837837        }
    838838        bkpinfo->make_filelist = FALSE;
    839         mr_asprintf(&p, "%s", flag_val['J']);
     839        mr_asprintf(p, "%s", flag_val['J']);
    840840        mr_free(bkpinfo->include_paths);
    841841        bkpinfo->include_paths = p;
     
    903903        strcpy(flag_val['d'], p);
    904904        mr_free(p);
    905         mr_asprintf(&tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
     905        mr_asprintf(tmp1, "You didn't specify a tape streamer device. I'm assuming %s", flag_val['d']);
    906906        log_to_screen(tmp1);
    907907        mr_free(tmp1);
     
    954954            }
    955955        }
    956 /*
    957       if (flag_set['Z']) {
    958       bkpinfo->blank_dvd_first = TRUE;
    959       }
    960 */
    961956    }
    962957
     
    10091004            p--;
    10101005            *p = '\0';
    1011             mr_asprintf(&q,"%s",bkpinfo->nfs_mount);
     1006            mr_asprintf(q,"%s",bkpinfo->nfs_mount);
    10121007            bkpinfo->nfs_user = q;
    10131008            strcpy(bkpinfo->nfs_mount,tmp);
    10141009        }
    1015         mr_asprintf(&tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3",
    1016                 bkpinfo->nfs_mount);
    1017         strncpy(bkpinfo->isodir,
    1018                 call_program_and_get_last_line_of_output(tmp1),
    1019                 MAX_STR_LEN / 4);
     1010        mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1011        mr_free(bkpinfo->isodir);
     1012        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1013        bkpinfo->isodir = tmp2;
    10201014        mr_free(tmp1);
    10211015
    10221016        if (strlen(bkpinfo->isodir) < 3) {
    10231017            log_to_screen("NFS share is not mounted. Trying to mount it for you.\n");
    1024             mr_asprintf(&tmp1, "mount %s", bkpinfo->nfs_mount);
     1018            mr_asprintf(tmp1, "mount %s", bkpinfo->nfs_mount);
    10251019            i = system(tmp1);
    10261020            mr_free(tmp1);
     
    10291023                retval++;
    10301024            } else {
    1031                 mr_asprintf(&tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
    1032                 strncpy(bkpinfo->isodir,
    1033                         call_program_and_get_last_line_of_output(tmp1),
    1034                         MAX_STR_LEN / 4);
     1025                mr_asprintf(tmp1, "mount | grep -E \"^%s[/]* .*\" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1026                mr_free(bkpinfo->isodir);
     1027                mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1028                bkpinfo->isodir = tmp2;
    10351029                mr_free(tmp1);
    10361030
     
    10781072    if (flag_set['z']) {
    10791073        if (find_home_of_exe("getfattr")) {
    1080             mr_asprintf(&g_getfattr,"getfattr");
     1074            mr_asprintf(g_getfattr,"getfattr");
    10811075        }
    10821076        if (find_home_of_exe("getfacl")) {
    1083             mr_asprintf(&g_getfacl,"getfacl");
     1077            mr_asprintf(g_getfacl,"getfacl");
    10841078        }
    10851079    }
     
    10951089            log_to_screen("Please supply a sensible value with '-E'\n");
    10961090        }
    1097         mr_asprintf(&tmp1, "%s", flag_val['E']);
     1091        mr_asprintf(tmp1, "%s", flag_val['E']);
    10981092
    10991093        p = tmp1;
     
    11631157    if ((flag_set['N']) && (! bkpinfo->restore_data))       // exclude NFS mounts & devices
    11641158    {
    1165         mr_asprintf(&psz, "%s", list_of_NFS_mounts_only());
     1159        mr_asprintf(psz, "%s", list_of_NFS_mounts_only());
    11661160        mr_strcat(bkpinfo->exclude_paths, " %s ", psz);
    11671161        mr_free(psz);
     
    11731167
    11741168    if (flag_set['b']) {
    1175         mr_asprintf(&psz, "%s", flag_val['b']);
     1169        mr_asprintf(psz, "%s", flag_val['b']);
    11761170        log_msg(1, "psz = '%s'", psz);
    11771171        if (psz[strlen(psz) - 1] == 'k') {
     
    12191213            && !does_file_exist(bkpinfo->kernel_path)) {
    12201214            retval++;
    1221             mr_asprintf(&tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
     1215            mr_asprintf(tmp1, "You specified kernel '%s', which does not exist\n", bkpinfo->kernel_path);
    12221216            log_to_screen(tmp1);
    12231217            mr_free(tmp1);
     
    12271221    if (flag_set['p']) {
    12281222        mr_free(bkpinfo->prefix);
    1229         mr_asprintf(&tmp1, "%s", flag_val['p']);
     1223        mr_asprintf(tmp1, "%s", flag_val['p']);
    12301224        bkpinfo->prefix = tmp1;
    12311225        log_msg(1,"Prefix forced to %s",bkpinfo->prefix);
     
    12341228    if (flag_set['d']) {        /* backup directory (if ISO/NFS) */
    12351229        if (flag_set['i']) {
    1236             strncpy(bkpinfo->isodir, flag_val['d'], MAX_STR_LEN / 4);
    1237             mr_asprintf(&tmp1, "ls -l %s", bkpinfo->isodir);
     1230            mr_free(bkpinfo->isodir);
     1231            mr_asprintf(tmp2, "%s", flag_val['d']);
     1232            bkpinfo->isodir = tmp2;
     1233            mr_asprintf(tmp1, "ls -l %s", bkpinfo->isodir);
    12381234            if (run_program_and_log_output(tmp1, 2)) {
    12391235                mr_free(tmp1);
    1240                 fatal_error
    1241                     ("output folder does not exist - please create it");
     1236                fatal_error("output folder does not exist - please create it");
    12421237            }
    12431238            mr_free(tmp1);
     
    12501245
    12511246    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    1252         mr_asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
     1247        mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->nfs_remote_dir);
    12531248        if (bkpinfo->nfs_user) {
    1254             mr_asprintf(&tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);
     1249            mr_asprintf(tmp2, "su - %s -c \"echo hi > %s\"", bkpinfo->nfs_user, tmp1);
    12551250        } else {
    1256             mr_asprintf(&tmp2, "echo hi > %s", tmp1);
     1251            mr_asprintf(tmp2, "echo hi > %s", tmp1);
    12571252        }
    12581253        i = run_program_and_log_output(tmp2, 2);
     
    12611256        if (i) {
    12621257            retval++;
    1263             mr_asprintf(&tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
     1258            mr_asprintf(tmp2, "Are you sure directory '%s' exists in remote dir '%s'?\nIf so, do you have rights to write to it?\n", bkpinfo->nfs_remote_dir, bkpinfo->nfs_mount);
    12641259            log_to_screen(tmp2);
    12651260            mr_free(tmp2);
     
    13021297
    13031298    if (flag_set['S']) {
    1304         mr_asprintf(&tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
     1299        mr_asprintf(tmp1, "%s/mondo.scratch.%ld", flag_val['S'], random() % 32768);
    13051300        mr_free(bkpinfo->scratchdir);
    13061301        bkpinfo->scratchdir = tmp1;
     
    13091304    if (flag_set['T']) {
    13101305        setup_tmpdir(flag_val['T']);
    1311         mr_asprintf(&tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir);
     1306        mr_asprintf(tmp1, "touch %s/.foo.dat", bkpinfo->tmpdir);
    13121307        i = run_program_and_log_output(tmp1, 1);
    13131308        mr_free(tmp1);
     
    13181313            fatal_error("I cannot write to the tempdir you specified.");
    13191314        }
    1320         mr_asprintf(&tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir);
     1315        mr_asprintf(tmp1, "ln -sf %s/.foo.dat %s/.bar.dat", bkpinfo->tmpdir, bkpinfo->tmpdir);
    13211316        i = run_program_and_log_output(tmp1, 1);
    13221317        mr_free(tmp1);
     
    15151510            if (flag_set[opt]) {
    15161511                bad_switches = TRUE;
    1517                 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
     1512                mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    15181513                log_to_screen(tmp);
    15191514                mr_free(tmp);
     
    15311526                        if (strchr(flag_val[opt], '/')
    15321527                            && flag_val[opt][0] != '/') {
    1533                             mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
     1528                            mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    15341529                            log_to_screen(tmp);
    15351530                            mr_free(tmp);
     
    15441539    for (i = optind; i < argc; i++) {
    15451540        bad_switches = TRUE;
    1546         mr_asprintf(&tmp, "Invalid arg -- %s\n", argv[i]);
     1541        mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]);
    15471542        log_to_screen(tmp);
    15481543        mr_free(tmp);
     
    15751570    switch (sig) {
    15761571    case SIGINT:
    1577         mr_asprintf(&tmp, "SIGINT");
    1578         mr_asprintf(&tmp2, "You interrupted me :-)");
     1572        mr_asprintf(tmp, "SIGINT");
     1573        mr_asprintf(tmp2, "You interrupted me :-)");
    15791574        break;
    15801575    case SIGKILL:
    1581         mr_asprintf(&tmp, "SIGKILL");
    1582         mr_asprintf(&tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
     1576        mr_asprintf(tmp, "SIGKILL");
     1577        mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
    15831578        break;
    15841579    case SIGTERM:
    1585         mr_asprintf(&tmp, "SIGTERM");
    1586         mr_asprintf(&tmp2, "Got terminate signal");
     1580        mr_asprintf(tmp, "SIGTERM");
     1581        mr_asprintf(tmp2, "Got terminate signal");
    15871582        break;
    15881583    case SIGHUP:
    1589         mr_asprintf(&tmp, "SIGHUP");
    1590         mr_asprintf(&tmp2, "Hangup on line");
     1584        mr_asprintf(tmp, "SIGHUP");
     1585        mr_asprintf(tmp2, "Hangup on line");
    15911586        break;
    15921587    case SIGSEGV:
    1593         mr_asprintf(&tmp, "SIGSEGV");
    1594         mr_asprintf(&tmp2, "Internal programming error. Please send a backtrace as well as your log.");
     1588        mr_asprintf(tmp, "SIGSEGV");
     1589        mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log.");
    15951590        break;
    15961591    case SIGPIPE:
    1597         mr_asprintf(&tmp, "SIGPIPE");
    1598         mr_asprintf(&tmp2, "Pipe was broken");
     1592        mr_asprintf(tmp, "SIGPIPE");
     1593        mr_asprintf(tmp2, "Pipe was broken");
    15991594        break;
    16001595    case SIGABRT:
    1601         mr_asprintf(&tmp, "SIGABRT");
    1602         mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
     1596        mr_asprintf(tmp, "SIGABRT");
     1597        mr_asprintf(tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
    16031598        break;
    16041599    default:
    1605         mr_asprintf(&tmp, "(Unknown)");
    1606         mr_asprintf(&tmp2, "(Unknown)");
     1600        mr_asprintf(tmp, "(Unknown)");
     1601        mr_asprintf(tmp2, "(Unknown)");
    16071602    }
    16081603
  • branches/2.2.10/mondo/src/common/libmondo-devices.c

    r2322 r2323  
    111111    bool is_this_a_ramdisk = FALSE;
    112112
    113     mr_asprintf(&tmp, "%s", where_is_root_mounted());
    114     mr_asprintf(&comment, "root is currently mounted at %s\n", tmp);
     113    mr_asprintf(tmp, "%s", where_is_root_mounted());
     114    mr_asprintf(comment, "root is currently mounted at %s\n", tmp);
    115115    log_msg(0, comment);
    116116    mr_free(comment);
     
    210210    if (IS_THIS_A_STREAMING_BACKUP(g_backup_media_type)
    211211        && g_backup_media_type != udev) {
    212         mr_asprintf(&command, "mt -f %s offline", dev);
     212        mr_asprintf(command, "mt -f %s offline", dev);
    213213        res1 = run_program_and_log_output(command, 1);
    214214        mr_free(command);
     
    219219#ifdef __FreeBSD__
    220220    if (strstr(dev, "acd")) {
    221         mr_asprintf(&command, "cdcontrol -f %s eject", dev);
     221        mr_asprintf(command, "cdcontrol -f %s eject", dev);
    222222    } else {
    223         mr_asprintf(&command, "camcontrol eject `echo %s | sed 's|/dev/||'`",
     223        mr_asprintf(command, "camcontrol eject `echo %s | sed 's|/dev/||'`",
    224224                dev);
    225225    }
    226226#else
    227     mr_asprintf(&command, "eject %s", dev);
     227    mr_asprintf(command, "eject %s", dev);
    228228#endif
    229229
     
    250250#ifdef __FreeBSD__
    251251    if (strstr(dev, "acd")) {
    252         mr_asprintf(&command, "cdcontrol -f %s close", dev);
     252        mr_asprintf(command, "cdcontrol -f %s close", dev);
    253253    } else {
    254         mr_asprintf(&command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);
     254        mr_asprintf(command, "camcontrol load `echo %s | sed 's|/dev/||'`", dev);
    255255    }
    256256#else
    257     mr_asprintf(&command, "eject -t %s", dev);
     257    mr_asprintf(command, "eject -t %s", dev);
    258258#endif
    259259    i = run_program_and_log_output(command, FALSE);
     
    277277    assert_string_is_neither_NULL_nor_zerolength(device);
    278278
    279     mr_asprintf(&tmp, "ls %s > /dev/null 2> /dev/null", device);
     279    mr_asprintf(tmp, "ls %s > /dev/null 2> /dev/null", device);
    280280
    281281    if (system(tmp)) {
     
    336336    // We assume here that this is running from mondorestore. (It is.)
    337337    tmp = build_partition_name(drive, partno);
    338     mr_asprintf(&program, "ls %s %s >/dev/null 2>&1", drive, tmp);
     338    mr_asprintf(program, "ls %s %s >/dev/null 2>&1", drive, tmp);
    339339    mr_free(tmp);
    340340
     
    347347#endif
    348348
    349     mr_asprintf(&program, "parted2fdisk -l %s 2> /dev/null", drive);
     349    mr_asprintf(program, "parted2fdisk -l %s 2> /dev/null", drive);
    350350    fin = popen(program, "r");
    351351    if (!fin) {
     
    394394    assert_string_is_neither_NULL_nor_zerolength(str);
    395395
    396     mr_asprintf(&command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);
     396    mr_asprintf(command, "dd if=%s bs=446 count=1 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, str);
    397397    i = system(command);
    398398    mr_free(command);
     
    418418    int i;
    419419
    420     mr_asprintf(&command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);
     420    mr_asprintf(command, "dd if=%s bs=512 count=%i 2> /dev/null | strings | grep \"%s\" > /dev/null 2> /dev/null", dev, n, str);
    421421    i = system(command);
    422422    mr_free(command);
     
    517517    run_program_and_log_output("insmod ide-scsi", -1);
    518518    if (find_home_of_exe("cdrecord")) {
    519         mr_asprintf(&cdr_exe, "cdrecord");
     519        mr_asprintf(cdr_exe, "cdrecord");
    520520    } else {
    521         mr_asprintf(&cdr_exe, "dvdrecord");
     521        mr_asprintf(cdr_exe, "dvdrecord");
    522522    }
    523523    if (find_home_of_exe(cdr_exe)) {
    524         mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
    525         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     524        mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep CD | cut -d' ' -f2 | head -n1", cdr_exe);
     525        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    526526        mr_free(command);
    527527    }
     
    532532    } else {
    533533        strcpy(cdrw_device, tmp);
    534         mr_asprintf(&comment, "Found CDRW device - %s", cdrw_device);
     534        mr_asprintf(comment, "Found CDRW device - %s", cdrw_device);
    535535        log_it(comment);
    536536        strcpy(g_cdrw_drive_is_here, cdrw_device);
     
    586586    phrase_two[0] = '\0';
    587587#ifndef __FreeBSD__
    588     mr_asprintf(&dvd_last_resort, "%s", "");;
     588    mr_asprintf(dvd_last_resort, "%s", "");;
    589589#endif
    590590
     
    606606    }
    607607
    608     mr_asprintf(&mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);
     608    mr_asprintf(mountpoint, "%s/cd.mnt", bkpinfo->tmpdir);
    609609    make_hole_for_dir(mountpoint);
    610610
    611611    if (find_home_of_exe("cdrecord")) {
    612         mr_asprintf(&cdr_exe, "cdrecord");
     612        mr_asprintf(cdr_exe, "cdrecord");
    613613    } else {
    614         mr_asprintf(&cdr_exe, "dvdrecord");
     614        mr_asprintf(cdr_exe, "dvdrecord");
    615615    }
    616616    tmp[0] = '\0';
     
    628628    }
    629629
    630     mr_asprintf(&command, "%s -scanbus 2> /dev/null", cdr_exe);
     630    mr_asprintf(command, "%s -scanbus 2> /dev/null", cdr_exe);
    631631    fin = popen(command, "r");
    632632    log_msg(4, "command=%s", command);
     
    668668        log_msg(4, "Not running phase two. String is empty.");
    669669    } else {
    670         mr_asprintf(&command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);
     670        mr_asprintf(command, "dmesg | grep \"%s\" 2> /dev/null", phrase_two);
    671671        fin = popen(command, "r");
    672672        mr_free(command);
     
    684684                        if (strstr(tmp, "DVD")) {
    685685                            mr_free(dvd_last_resort);
    686                             mr_asprintf(&dvd_last_resort, "/dev/%s", tmp);
     686                            mr_asprintf(dvd_last_resort, "/dev/%s", tmp);
    687687                            log_msg(4,
    688688                                    "Ignoring '%s' because it's a DVD drive",
     
    815815                found_it = FALSE;
    816816            } else {
    817                 mr_asprintf(&command, "umount %s", output);
     817                mr_asprintf(command, "umount %s", output);
    818818                paranoid_system(command);
    819819                mr_free(command);
     
    838838    }
    839839
    840     mr_asprintf(&command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
     840    mr_asprintf(command, "%s -scanbus | grep \"[0-9],[0-9],[0-9]\" | grep \"[D|C][V|D]\" | grep -n \"\" | grep \"%s\" | cut -d':' -f2", cdr_exe, g_cdrw_drive_is_here);
    841841    log_msg(1, "command=%s", command);
    842     mr_asprintf(&tmp1, "%s", call_program_and_get_last_line_of_output(command));
     842    mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
    843843    mr_free(command);
    844844
     
    876876    }
    877877
    878     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output
     878    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    879879            ("dvdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    880880        );
     
    882882    if (!tmp[0])
    883883        mr_free(tmp);
    884         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output
     884        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output
    885885                ("cdrecord -scanbus 2> /dev/null | grep \") '\" | grep -n \"\" | grep DVD | cut -d':' -f1")
    886886            );
     
    10261026    assert_string_is_neither_NULL_nor_zerolength(format);
    10271027
    1028     mr_asprintf(&format_sz, "%s ", format);
     1028    mr_asprintf(format_sz, "%s ", format);
    10291029
    10301030#ifdef __FreeBSD__
    1031     mr_asprintf(&command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
     1031    mr_asprintf(command, "lsvfs | tr -s '\t' ' ' | grep -v Filesys | grep -v -- -- | cut -d' ' -f1 | tr -s '\n' ' '");
    10321032#else
    1033     mr_asprintf(&command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
     1033    mr_asprintf(command, "grep -v nodev /proc/filesystems | tr -s '\t' ' ' | cut -d' ' -f2 | tr -s '\n' ' '");
    10341034#endif
    10351035
     
    10941094        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
    10951095                device_raw);
    1096         mr_asprintf(&tmp, "/%s", device_raw);
     1096        mr_asprintf(tmp, "/%s", device_raw);
    10971097    } else {
    1098         mr_asprintf(&tmp, "%s", device_raw);
     1098        mr_asprintf(tmp, "%s", device_raw);
    10991099    }
    11001100    log_msg(1, "Is %s mounted?", tmp);
     
    11051105        return(FALSE);
    11061106    }
    1107     mr_asprintf(&device_with_tab, "%s\t", tmp);
    1108     mr_asprintf(&device_with_space, "%s ", tmp);
     1107    mr_asprintf(device_with_tab, "%s\t", tmp);
     1108    mr_asprintf(device_with_space, "%s ", tmp);
    11091109    mr_free(tmp);
    11101110
     
    11261126    mr_free(device_with_space);
    11271127    paranoid_pclose(fin);
    1128     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
     1128    mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11291129    log_msg(4, "tmp (command) = '%s'", tmp);
    11301130    if (!system(tmp)) {
     
    11931193        (call_program_and_get_last_line_of_output
    11941194         ("/sbin/sysctl -n kern.osreldate")) < 500000) {
    1195         mr_asprintf(&command, "vnconfig -d %s", dname);
     1195        mr_asprintf(command, "vnconfig -d %s", dname);
    11961196    } else {
    1197         mr_asprintf(&command, "mdconfig -d -u %s", dname);
     1197        mr_asprintf(command, "mdconfig -d -u %s", dname);
    11981198    }
    11991199    res = system(command);
     
    12271227
    12281228#ifdef __FreeBSD__
    1229     mr_asprintf(&command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1229    mr_asprintf(command, "mount_vfat %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12301230
    12311231#else
    1232     mr_asprintf(&command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1232    mr_asprintf(command, "mount %s -t vfat %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12331233#endif
    12341234
     
    12671267    }
    12681268#ifndef __FreeBSD__
    1269     mr_asprintf(&options, "ro");
     1269    mr_asprintf(options, "ro");
    12701270#endif
    12711271
     
    12731273
    12741274#ifdef __FreeBSD__
    1275         mr_asprintf(&dev, "%s", make_vn(device));
     1275        mr_asprintf(dev, "%s", make_vn(device));
    12761276        if (!dev) {
    1277             mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     1277            mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device);
    12781278            fatal_error(command);
    12791279        }
     
    12901290
    12911291#ifdef __FreeBSD__
    1292     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1292    mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    12931293
    12941294#else
    1295     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
     1295    mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    12961296    paranoid_free(options);
    12971297#endif
     
    13341334    /*@ buffers ********************************************************* */
    13351335    char *tmp = NULL;
     1336    char *p = NULL;
    13361337    char *mds = NULL;
    13371338    char *request = NULL;
     
    13471348        return;
    13481349    }
    1349     mr_asprintf(&tmp, "mkdir -p " MNT_CDROM);
     1350    mr_asprintf(tmp, "mkdir -p " MNT_CDROM);
    13501351    run_program_and_log_output(tmp, 5);
    13511352    mr_free(tmp);
     
    13601361            run_program_and_log_output("umount " MNT_CDROM, 5);
    13611362        }
    1362         mr_asprintf(&tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
     1363        mr_asprintf(tmp, "mkdir -p %s/isodir &> /dev/null", bkpinfo->tmpdir);
    13631364        (void)system(tmp);
    13641365        mr_free(tmp);
    13651366
    1366         mr_asprintf(&tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1367        mr_asprintf(tmp, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13671368        if (!does_file_exist(tmp)) {
    13681369            mr_free(tmp);
    1369             mr_asprintf(&tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
     1370            mr_asprintf(tmp, "%s/isodir/%s/%s-%d.iso", bkpinfo->tmpdir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, cd_number_i_want);
    13701371            if (does_file_exist(tmp)) {
    13711372                log_msg(1, "FIXME - hacking bkpinfo->isodir from '%s' to %s/isodir", bkpinfo->isodir, bkpinfo->tmpdir);
    1372                 sprintf(bkpinfo->isodir, "%s/isodir", bkpinfo->tmpdir);
     1373                mr_free(bkpinfo->isodir);
     1374                mr_asprintf(p, "%s/isodir", bkpinfo->tmpdir);
     1375                bkpinfo->isodir = p;
    13731376            }
    13741377        }
     
    13841387                cd_number_i_want);
    13851388        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1386         mr_asprintf(&tmp, "Insisting on %s #%d", mds, cd_number_i_want);
    1387         mr_asprintf(&request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
     1389        mr_asprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);
     1390        mr_asprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
    13881391        mr_free(mds);
    13891392        log_msg(3, tmp);
     
    14991502            }
    15001503            mds = media_descriptor_string(bkpinfo->backup_media_type);
    1501             mr_asprintf(&comment, "What speed is your %s (re)writer?", mds);
     1504            mr_asprintf(comment, "What speed is your %s (re)writer?", mds);
    15021505            if (bkpinfo->backup_media_type == dvd) {
    15031506                find_dvd_device(bkpinfo->media_device, FALSE);
    1504                 strcpy(tmp1, "1");
    1505                 mr_asprintf(&sz_size, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB
     1507                mr_asprintf(tmp, "1");
     1508                mr_asprintf(sz_size, "%d", DEFAULT_DVD_DISK_SIZE);  // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    15061509                log_msg(1, "Setting to DVD defaults");
    15071510            } else {
    15081511                strcpy(bkpinfo->media_device, VANILLA_SCSI_CDROM);
    1509                 strcpy(tmp1, "4");
    1510                 mr_asprintf(&sz_size, "%d", 650);
     1512                mr_asprintf(tmp, "4");
     1513                mr_asprintf(sz_size, "%d", 650);
    15111514                log_msg(1, "Setting to CD defaults");
    15121515            }
     
    15271530            bkpinfo->cdrw_speed = atoi(tmp1);   // if DVD then this shouldn't ever be used anyway :)
    15281531
    1529             mr_asprintf(&comment, "How much data (in Megabytes) will each %s store?", mds);
     1532            mr_asprintf(comment, "How much data (in Megabytes) will each %s store?", mds);
    15301533            mr_free(mds);
    15311534            p = popup_and_get_string("Size", comment, sz_size);
     
    15671570                log_msg(1, "bkpinfo->media_device = %s",
    15681571                        bkpinfo->media_device);
    1569                 mr_asprintf(&comment, "Please specify your %s drive's /dev entry", mds);
     1572                mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds);
    15701573                p = popup_and_get_string("Device?", comment, bkpinfo->media_device);
    15711574                mr_free(comment);
     
    15851588            if (bkpinfo->media_device[0]) {
    15861589                if (bkpinfo->backup_media_type == usb) {
    1587                     mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
     1590                    mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    15881591                } else {
    1589                     mr_asprintf(&tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);
     1592                    mr_asprintf(tmp, "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds, bkpinfo->media_device);
    15901593                }
    15911594                if (!ask_me_yes_or_no(tmp)) {
     
    16481651        }
    16491652        if (bkpinfo->media_device[0]) {
    1650             mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
     1653            mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    16511654            if (!ask_me_yes_or_no(tmp)) {
    16521655                bkpinfo->media_device[0] = '\0';
     
    16631666            mr_free(p);
    16641667        }
    1665         mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device);
     1668        mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device);
    16661669        if (run_program_and_log_output(tmp, FALSE)) {
    16671670            log_to_screen("User has not specified a valid /dev entry");
     
    17261729            if (bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] == '/')
    17271730                bkpinfo->nfs_mount[strlen(bkpinfo->nfs_mount) - 1] = '\0';
    1728             mr_asprintf(&command, "mount | grep \"%s \" | cut -d' ' -f3",
    1729                     bkpinfo->nfs_mount);
    1730             strcpy(bkpinfo->isodir,
    1731                    call_program_and_get_last_line_of_output(command));
     1731            mr_asprintf(command, "mount | grep \"%s \" | cut -d' ' -f3", bkpinfo->nfs_mount);
     1732            mr_free(bkpinfo->isodir);
     1733            mr_asprintf(p, "%s", call_program_and_get_last_line_of_output(command));
     1734            bkpinfo->isodir = p;
    17321735            mr_free(command);
    17331736
    17341737            if (!bkpinfo->restore_data) {
    1735                 mr_asprintf(&comment, "How much data (in Megabytes) will each media store?");
     1738                mr_asprintf(comment, "How much data (in Megabytes) will each media store?");
    17361739                // BERLIOS: 4480 shouldn't be hardcoded here
    17371740                sz_size = popup_and_get_string("Size", comment, "4480");
     
    17421745                }
    17431746            } else {
    1744                 mr_asprintf(&sz_size, "0");
     1747                mr_asprintf(sz_size, "0");
    17451748            }
    17461749            for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
     
    17541757        }
    17551758        if (bkpinfo->disaster_recovery) {
    1756             mr_asprintf(&command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
     1759            mr_asprintf(command ,"umount %s/isodir 2> /dev/null", bkpinfo->tmpdir);
    17571760            (void)system(command);
    17581761            mr_free(command);
     
    17671770        }
    17681771        /* Initiate bkpinfo isodir path from running environment if mount already done */
     1772        mr_free(bkpinfo->isodir);
    17691773        if (is_this_device_mounted(bkpinfo->nfs_mount)) {
    1770             strcpy(bkpinfo->isodir,
    1771                    call_program_and_get_last_line_of_output
    1772                    ("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
     1774            mr_asprintf(p, "%s", call_program_and_get_last_line_of_output("mount | grep \":\" | cut -d' ' -f3 | head -n1"));
     1775            bkpinfo->isodir = p;
     1776
    17731777        } else {
    1774             sprintf(bkpinfo->isodir, "%s/nfsdir", bkpinfo->tmpdir);
    1775             mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir);
     1778            mr_asprintf(p, "%s/nfsdir", bkpinfo->tmpdir);
     1779            bkpinfo->isodir = p;
     1780            mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    17761781            run_program_and_log_output(command, 5);
    17771782            mr_free(command);
    17781783
    1779             mr_asprintf(&tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
     1784            mr_asprintf(tmp, "mount -t nfs -o nolock %s %s", bkpinfo->nfs_mount, bkpinfo->isodir);
    17801785            run_program_and_log_output(tmp, 3);
    17811786            mr_free(tmp);
     
    18201825                finish(1);
    18211826            }
    1822             strcpy(bkpinfo->isodir,p);
    1823             mr_free(p);
     1827            bkpinfo->isodir = p;
    18241828
    18251829            if (archiving_to_media) {
     
    19181922        bkpinfo->boot_loader = i;
    19191923        mr_free(bkpinfo->include_paths);
    1920         mr_asprintf(&p, "/");
     1924        mr_asprintf(p, "/");
    19211925        bkpinfo->include_paths = p;
    19221926
     
    19291933        bkpinfo->include_paths = p;
    19301934
    1931         mr_asprintf(&tmp, "%s", list_of_NFS_mounts_only());
     1935        mr_asprintf(tmp, "%s", list_of_NFS_mounts_only());
    19321936        if (strlen(tmp) > 2) {
    19331937            mr_strcat(bkpinfo->exclude_paths, " %s",tmp);
     
    19351939        mr_free(tmp);
    19361940// NTFS
    1937         strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    1938         if (strlen(tmp1) > 2) {
     1941        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     1942        if (strlen(tmp) > 2) {
    19391943            p = popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp);
    19401944
     
    20082012#else
    20092013    if (bkpinfo->backup_media_type == nfs) {
    2010         log_msg(3, "I think the NFS mount is mounted at %s",
    2011                 bkpinfo->isodir);
     2014        log_msg(3, "I think the NFS mount is mounted at %s", bkpinfo->isodir);
    20122015    }
    20132016    log_it("isodir = %s", bkpinfo->isodir);
     
    20612064    static char result_sz[1024];
    20622065
    2063     mr_asprintf(&exclude_these_directories,"%s",list_of_NFS_mounts_only());
    2064     mr_asprintf(&exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2066    mr_asprintf(exclude_these_directories,"%s",list_of_NFS_mounts_only());
     2067    mr_asprintf(exclude_these_devices,"%s", call_program_and_get_last_line_of_output("tr -s '\t' ' ' < /etc/fstab | grep -E '( (coda|ncpfs|nfs|nfs4|smbfs|cifs|afs|gfs|ocfs|ocfs2|mvfs|nsspool|nsvol) )' | cut -d' ' -f1 | tr -s '\n' ' ' | awk '{print $0;}'"));
    20652068    snprintf(result_sz, 1023, "%s %s", exclude_these_directories, exclude_these_devices);
    20662069    mr_free(exclude_these_devices);
     
    20832086    static char result_sz[512];
    20842087
    2085     mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
     2088    mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,nfs,nfs4,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' ' ' | awk '{print $0;}'"));
    20862089    snprintf(result_sz, 511, "%s", exclude_these_directories);
    20872090    mr_free(exclude_these_directories);
     
    21122115    make_hole_for_file(store_name_here);
    21132116    mkfifo(store_name_here, S_IRWXU | S_IRWXG);
    2114     mr_asprintf(&tmp, "chmod 770 %s", store_name_here);
     2117    mr_asprintf(tmp, "chmod 770 %s", store_name_here);
    21152118    paranoid_system(tmp);
    21162119    mr_free(tmp);
     
    21352138
    21362139#ifdef __FreeBSD__
    2137     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2140    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21382141#else
    2139     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
     2142    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x vfat -x ntfs -x ntfs-3g -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660| sed 's/                  /devdev/' | tr -s '\t' ' ' | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -n | tail -n1 | awk '{print $NF;}'"));
    21402143#endif
    21412144
    21422145    if (tmp[0] != '/') {
    2143         mr_asprintf(&sz, "%s", tmp);
     2146        mr_asprintf(sz, "%s", tmp);
    21442147        mr_free(tmp);
    2145         mr_asprintf(&tmp, "/%s", sz);
     2148        mr_asprintf(tmp, "/%s", sz);
    21462149        mr_free(sz);
    21472150    }
     
    21492152        fatal_error("I couldn't figure out the scratchdir!");
    21502153    }
    2151     mr_asprintf(&sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
     2154    mr_asprintf(sz, "%s/mondo.scratch.%d", tmp, (int) (random() % 32768));
    21522155    mr_free(bkpinfo->scratchdir);
    21532156    bkpinfo->scratchdir = sz;
    21542157    log_it("bkpinfo->scratchdir is being set to %s", bkpinfo->scratchdir);
    21552158
    2156     mr_asprintf(&command, "rm -Rf %s/mondo.scratch.*", tmp);
     2159    mr_asprintf(command, "rm -Rf %s/mondo.scratch.*", tmp);
    21572160    mr_free(tmp);
    21582161
     
    21922195        return (FALSE);
    21932196    }
    2194     mr_asprintf(&command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);
     2197    mr_asprintf(command, "dd bs=%ld count=1 if=%s of=/dev/null &> /dev/null", 512L, dev);
    21952198    if (!run_program_and_log_output(command, FALSE)
    21962199        && !run_program_and_log_output(command, FALSE)) {
     
    22272230//  log_it("Asking what_number_cd_is_this");
    22282231    if (g_ISO_restore_mode) {
    2229         mr_asprintf(&tmp, "mount | grep iso9660 | awk '{print $3;}'");
    2230 
    2231         mr_asprintf(&mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
     2232        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
     2233
     2234        mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
    22322235        cd_number = atoi(last_line_of_file(mountdev));
    22332236        paranoid_free(mountdev);
     
    22372240    }
    22382241
    2239     mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
     2242    mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    22402243    if (!mountdev[0]) {
    22412244        log_it
     
    23702373    assert(which_device != NULL);
    23712374
    2372     mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
     2375    mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
    23732376    log_it("list_drives_cmd = %s", list_drives_cmd);
    23742377
     
    24122415    } else {
    24132416        // We need to look on each partition then
    2414         mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     2417        mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    24152418        log_it("list_drives_cmd = %s", list_drives_cmd);
    24162419
     
    25132516        while (S_ISLNK(statbuf.st_mode)) {
    25142517            log_msg(1, "curr_fname = %s", curr_fname);
    2515             mr_asprintf(&command, "file %s", curr_fname);
    2516             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2518            mr_asprintf(command, "file %s", curr_fname);
     2519            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    25172520            mr_free(command);
    25182521            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    25192522                 p--);
    25202523            p++;
    2521             mr_asprintf(&scratch, "%s", p);
     2524            mr_asprintf(scratch, "%s", p);
    25222525            for (p = scratch; *p != '\0' && *p != '\''; p++);
    25232526            *p = '\0';
     
    25632566#endif
    25642567    log_msg(0, "Looking for partition table format type");
    2565     mr_asprintf(&fdisk, "/sbin/parted2fdisk");
     2568    mr_asprintf(fdisk, "/sbin/parted2fdisk");
    25662569    log_msg(1, "Using %s", fdisk);
    2567     mr_asprintf(&command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
     2570    mr_asprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    25682571    mr_free(fdisk);
    25692572
    2570     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2573    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    25712574    mr_free(command);
    25722575
  • branches/2.2.10/mondo/src/common/libmondo-fifo.c

    r2296 r2323  
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
    90         mr_asprintf(&tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
     90        mr_asprintf(tmp, "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c", internal_tape_block_size, bufsize, 'm');
    9191        res = run_program_and_log_output(tmp, 2);
    9292        mr_free(tmp);
     
    9494    if (!res) {
    9595        bufsize++;
    96         mr_asprintf(&tmp, "Negotiated max buffer of %d MB ", bufsize);
     96        mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize);
    9797        log_to_screen(tmp);
    9898        mr_free(tmp);
     
    118118    }
    119119    log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer);
    120     mr_asprintf(&sz_dir, "%c", direction);
     120    mr_asprintf(sz_dir, "%c", direction);
    121121    fres = popen(g_sz_call_to_buffer, sz_dir);
    122122    mr_free(sz_dir);
     
    130130    }
    131131    sleep(2);
    132     mr_asprintf(&tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
     132    mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    133133    if (run_program_and_log_output(tmp, 2)) {
    134134        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    136136    mr_free(tmp);
    137137    g_tape_buffer_size_MB = bufsize;
    138     mr_asprintf(&command, "ps %s | grep buffer | grep -v grep", ps_options);
     138    mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    139139    if (run_program_and_log_output(command, 1)) {
    140140        fres = NULL;
     
    165165    }
    166166    paranoid_system("sync");
    167     mr_asprintf(&command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
     167    mr_asprintf(command, "ps %s | grep -F \"%s\" | grep -Fv grep | awk '{print $2;}' | grep -v PID | head -1", ps_options, g_sz_call_to_buffer);
    168168    log_msg(2, "kill_buffer() --- command = %s", command);
    169     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     169    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    170170    mr_free(command);
    171171
    172     mr_asprintf(&command, "kill %s", tmp);
     172    mr_asprintf(command, "kill %s", tmp);
    173173    log_msg(2, "kill_buffer() --- command = %s", command);
    174174    if (strlen(tmp) > 0) {
  • branches/2.2.10/mondo/src/common/libmondo-filelist.c

    r2321 r2323  
    9797    log_to_screen("Dividing filelist into sets. Please wait.");
    9898    i = 0;
    99     mr_asprintf(&filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
     99    mr_asprintf(filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
    100100    if (!does_file_exist(filelist)) {
    101101        log_it("filelist %s not found", filelist);
     
    108108    estimate_noof_media_required(noof_sets);    // for cosmetic purposes
    109109
    110     mr_asprintf(&tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
     110    mr_asprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
    111111    if (!(fout = fopen(tempfile, "a"))) {
    112112        log_OS_error("Cannot append to biggielist");
     
    158158    }                           // no sense in trying to sort an empty file
    159159
    160     mr_asprintf(&tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
    161 
    162     mr_asprintf(&command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
     160    mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
     161
     162    mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
    163163    retval = system(command);
    164164    mr_free(command);
     
    168168    } else {
    169169        log_msg(5, "Sorted %s --> %s OK. Copying it back to %s now", orig_fname, tmp_fname, orig_fname);
    170         mr_asprintf(&command, "mv -f %s %s", tmp_fname, orig_fname);
     170        mr_asprintf(command, "mv -f %s %s", tmp_fname, orig_fname);
    171171        retval += run_program_and_log_output(command, 5);
    172172        mr_free(command);
     
    240240    curr_set_no = 0;
    241241    curr_set_size = 0;
    242     mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
    243     mr_asprintf(&biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir);
     242    mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
     243    mr_asprintf(biggie_fname, "%s/biggielist.txt", bkpinfo->tmpdir);
    244244    log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname);
    245245    if (!(fbig = fopen(biggie_fname, "w"))) {
     
    293293                curr_set_size = 0;
    294294
    295                 mr_asprintf(&outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
     295                mr_asprintf(outfname, "%s/filelist.%ld", bkpinfo->tmpdir, curr_set_no);
    296296                if (!(fout = fopen(outfname, "w"))) {
    297297                    log_OS_error("Unable to openout outfname");
     
    323323    mr_free(biggie_fname);
    324324
    325     mr_asprintf(&outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    326     mr_asprintf(&tmp, "%ld", curr_set_no);
     325    mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
     326    mr_asprintf(tmp, "%ld", curr_set_no);
    327327    if (write_one_liner_data_file(outfname, tmp)) {
    328328        log_OS_error
     
    334334
    335335    if (curr_set_no == 0) {
    336         mr_asprintf(&tmp, "Only one fileset. Fine.");
     336        mr_asprintf(tmp, "Only one fileset. Fine.");
    337337    } else {
    338         mr_asprintf(&tmp, "Filelist divided into %ld sets", curr_set_no + 1);
     338        mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1);
    339339    }
    340340    log_msg(1, tmp);
     
    453453        return (1);
    454454    }
    455     mr_asprintf(&pout_command, "gzip -c1 > %s", auxlist_fname);
     455    mr_asprintf(pout_command, "gzip -c1 > %s", auxlist_fname);
    456456    if (!(pout = popen(pout_command, "w"))) {
    457457        log_msg(1, "Cannot openout auxlist_fname %s", auxlist_fname);
     
    471471        log_msg(8, "Analyzing %s", file_to_analyze);
    472472        tmp = mr_stresc(file_to_analyze, "`$\\\"(){}[]'*?&|!#~", '\\');
    473         mr_asprintf(&strtmp, syscall_sprintf, tmp);
     473        mr_asprintf(strtmp, syscall_sprintf, tmp);
    474474        paranoid_free(tmp);
    475         mr_asprintf(&syscall, "%s 2>> /dev/null", strtmp);  // " MONDO_LOGFILE);
     475        mr_asprintf(syscall, "%s 2>> /dev/null", strtmp);   // " MONDO_LOGFILE);
    476476        paranoid_free(strtmp);
    477477        call_exe_and_pipe_output_to_fd(syscall, pout);
     
    491491
    492492    if (g_getfacl != NULL) {
    493         mr_asprintf(&command, "touch %s", facl_fname);
     493        mr_asprintf(command, "touch %s", facl_fname);
    494494        run_program_and_log_output(command, 8);
    495495        mr_free(command);
    496496
    497         mr_asprintf(&command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);
     497        mr_asprintf(command, "getfacl --all-effective -P %s 2>> %s | gzip -c1 > %s 2>> %s", filelist, MONDO_LOGFILE, facl_fname, MONDO_LOGFILE);
    498498        log_it("%s",command);
    499499        retval = system(command);
     
    510510
    511511    if (g_getfattr != NULL) {
    512         mr_asprintf(&command, "touch %s", fattr_fname);
     512        mr_asprintf(command, "touch %s", fattr_fname);
    513513        run_program_and_log_output(command, 8);
    514514        mr_free(command);
     
    540540        || !does_file_exist(orig_msklist)) {
    541541        log_msg(1, "No masklist provided. I shall therefore set ALL attributes.");
    542         mr_asprintf(&command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE);
     542        mr_asprintf(command, "gzip -dc %s | %s --restore - 2>> %s", original_exat_fname, executable, MONDO_LOGFILE);
    543543        log_msg(1, "command = %s", command);
    544544        retval = system(command);
     
    554554    malloc_string(current_subset_file);
    555555    malloc_string(current_master_file);
    556     mr_asprintf(&masklist, "%s/masklist", bkpinfo->tmpdir);
    557     mr_asprintf(&command, "cp -f %s %s", orig_msklist, masklist);
     556    mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir);
     557    mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist);
    558558    run_program_and_log_output(command, 1);
    559559    mr_free(command);
     
    562562    current_subset_file[0] = current_master_file[0] = '\0';
    563563
    564     mr_asprintf(&syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
     564    mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
    565565    log_msg(1, "syscall_pout = %s", syscall_pout);
    566566    pout = popen(syscall_pout, "w");
     
    573573    }
    574574
    575     mr_asprintf(&syscall_pin, "gzip -dc %s", original_exat_fname);
     575    mr_asprintf(syscall_pin, "gzip -dc %s", original_exat_fname);
    576576    log_msg(1, "syscall_pin = %s", syscall_pin);
    577577    pin = popen(syscall_pin, "r");
     
    714714
    715715    strcpy(val_sz,"");
    716     mr_asprintf(&cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
     716    mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
    717717    read_cfg_var(cfg_fname, "last-filelist-number", val_sz);
    718718    mr_free(cfg_fname);
     
    876876    }
    877877    log_to_screen("Loading filelist");
    878     mr_asprintf(&tmp1, "zcat %s | wc -l", filelist_fname);
     878    mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname);
    879879    log_msg(6, "tmp1 = %s", tmp1);
    880880    lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1));
     
    896896    (filelist->down)->expanded = (filelist->down)->selected = FALSE;
    897897
    898     mr_asprintf(&command_to_open_fname, "gzip -dc %s", filelist_fname);
     898    mr_asprintf(command_to_open_fname, "gzip -dc %s", filelist_fname);
    899899    if (!(pin = popen(command_to_open_fname, "r"))) {
    900900        log_OS_error("Unable to openin filelist_fname");
     
    13681368        malloc_string(name_of_evalcall_form);
    13691369        malloc_string(find_skeleton_marker);
    1370         mr_asprintf(&find_excludes, " ");
     1370        mr_asprintf(find_excludes, " ");
    13711371        if (sth != NULL) {
    13721372            while((token = mr_strtok(sth, delims, &lastpos))) {
     
    13771377#if linux
    13781378        // 2.6 has /sys as a proc-type thing -- must be excluded
    1379         mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
     1379        mr_asprintf(strtmp, "find '%s' -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype proc -prune -o -fstype sysfs -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
    13801380#else
    13811381        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1382         mr_asprintf(&strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
     1382        mr_asprintf(strtmp, "find '%s' -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, find_excludes, g_skeleton_filelist);
    13831383#endif
    13841384        mr_free(find_excludes);
     
    13881388        mr_free(strtmp);
    13891389
    1390         mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     1390        mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    13911391        g_skeleton_entries = 1 + atol(call_program_and_get_last_line_of_output(tmp));
    13921392        mr_free(tmp);
     
    14141414#ifndef _XWIN
    14151415                if (!g_text_mode) {
    1416                     mr_asprintf(&tmp, "Reading %-68s", dir);
     1416                    mr_asprintf(tmp, "Reading %-68s", dir);
    14171417                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14181418                    paranoid_free(tmp);
     
    14281428//  log_msg(0, "Cataloguing %s", dir);
    14291429    if (sth[0] == ' ') {
    1430         mr_asprintf(&skip_these, "%s", sth);
     1430        mr_asprintf(skip_these, "%s", sth);
    14311431    } else {
    1432         mr_asprintf(&skip_these, " %s ", sth);
    1433     }
    1434     mr_asprintf(&new_with_spaces, " %s ", dir);
     1432        mr_asprintf(skip_these, " %s ", sth);
     1433    }
     1434    mr_asprintf(new_with_spaces, " %s ", dir);
    14351435    if ((dip = opendir(dir)) == NULL) {
    1436         mr_asprintf(&tmp,"opendir %s", dir);
     1436        mr_asprintf(tmp,"opendir %s", dir);
    14371437        log_OS_error(tmp);
    14381438        paranoid_free(tmp);
     
    14441444            i++;
    14451445            if (strcmp(dir, "/")) {
    1446                 mr_asprintf(&new,"%s/%s",dir,dit->d_name);
     1446                mr_asprintf(new,"%s/%s",dir,dit->d_name);
    14471447            } else {
    1448                 mr_asprintf(&new,"%s%s",dir,dit->d_name);
     1448                mr_asprintf(new,"%s%s",dir,dit->d_name);
    14491449            }
    14501450            paranoid_free(new_with_spaces);
    1451             mr_asprintf(&new_with_spaces, " %s ", new);
     1451            mr_asprintf(new_with_spaces, " %s ", new);
    14521452            if (strstr(skip_these, new_with_spaces)) {
    14531453                fprintf(fout, "%s\n", new);
     
    14681468                                counter = 0;
    14691469                                uberctr++;
    1470                                 mr_asprintf(&tmp, " %c ", special_dot_char(uberctr));
     1470                                mr_asprintf(tmp, " %c ", special_dot_char(uberctr));
    14711471#ifndef _XWIN
    14721472                                if (!g_text_mode) {
     
    15211521    bool in_quotes = FALSE;
    15221522
    1523     mr_asprintf(&sz_res, "%s", incoming);
     1523    mr_asprintf(sz_res, "%s", incoming);
    15241524    p = sz_res;
    15251525    while ((*p != ' ' || in_quotes) && *p != '\0') {
     
    15631563    malloc_string(tmp);
    15641564    malloc_string(g_skeleton_filelist);
    1565     mr_asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1565    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15661566    if (!include_paths && !userdef_filelist) {
    15671567        fatal_error
     
    15691569    }
    15701570    // make hole for filelist
    1571     mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1571    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    15721572    paranoid_system(command);
    15731573    mr_free(command);
    15741574
    1575     mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     1575    mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    15761576    make_hole_for_file(sz_filelist);
    15771577
    15781578    if (differential == 0) {
    15791579        // restore last good datefile if it exists
    1580         mr_asprintf(&command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
     1580        mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
    15811581        run_program_and_log_output(command, 3);
    15821582        mr_free(command);
     
    15841584        // backup last known good datefile just in case :)
    15851585        if (does_file_exist(sz_datefile)) {
    1586             mr_asprintf(&command, "mv -f %s %s.aborted", sz_datefile,
     1586            mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile,
    15871587                    sz_datefile);
    15881588            paranoid_system(command);
     
    16091609                "Using the user-specified filelist - %s - instead of calculating one",
    16101610                userdef_filelist);
    1611         mr_asprintf(&command, "cp -f %s %s", userdef_filelist, sz_filelist);
     1611        mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
    16121612        if (run_program_and_log_output(command, 3)) {
    16131613            mr_free(command);
     
    16201620        }
    16211621        log_msg(1, "Calculating filelist");
    1622         mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1622        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    16231623        if (strlen(tmp2) < 1) {
    1624             mr_asprintf(&tmp1," ");
     1624            mr_asprintf(tmp1," ");
    16251625        } else {
    16261626            log_msg(2, "Found windows FS: %s",tmp2);
    1627             mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1627            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    16281628            paranoid_free(tmp2);
    1629             mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1629            mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16301630            log_msg(2, "Found windows files: %s",tmp2);
    16311631        }
    16321632        mr_free(tmp1);
    16331633
    1634         mr_asprintf(&exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
     1634        mr_asprintf(exclude_paths, " %s %s %s %s %s . ..  " MNT_CDROM " " MNT_FLOPPY " /media /tmp  /proc /sys " MINDI_CACHE, MONDO_CACHE, (excp == NULL) ? "" : excp, tmp2, (bkpinfo->tmpdir[0] == '/' && bkpinfo->tmpdir[1] == '/') ? (bkpinfo->tmpdir + 1) : bkpinfo->tmpdir, (bkpinfo->scratchdir[0] == '/' && bkpinfo->scratchdir[1] == '/') ? (bkpinfo->scratchdir + 1) : bkpinfo->scratchdir);
    16351635        mr_free(tmp2);
    16361636
     
    16671667    }
    16681668    log_msg(2, "Copying new filelist to scratchdir");
    1669     mr_asprintf(&command, "mkdir -p %s/archives", bkpinfo->scratchdir);
     1669    mr_asprintf(command, "mkdir -p %s/archives", bkpinfo->scratchdir);
    16701670    paranoid_system(command);
    16711671    mr_free(command);
    16721672
    1673     mr_asprintf(&command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
     1673    mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, bkpinfo->scratchdir);
    16741674    paranoid_system(command);
    16751675    mr_free(command);
    16761676
    1677     mr_asprintf(&command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
     1677    mr_asprintf(command, "mv -f %s %s", sz_filelist, bkpinfo->tmpdir);
    16781678    paranoid_system(command);
    16791679    mr_free(command);
  • branches/2.2.10/mondo/src/common/libmondo-files.c

    r2321 r2323  
    6262    assert_string_is_neither_NULL_nor_zerolength(filename);
    6363    if (does_file_exist(filename)) {
    64         mr_asprintf(&command, "md5sum \"%s\"", filename);
     64        mr_asprintf(command, "md5sum \"%s\"", filename);
    6565        fin = popen(command, "r");
    6666        if (fin) {
     
    7171        mr_free(command);
    7272    } else {
    73         mr_asprintf(&tmp, "File '%s' not found; cannot calc checksum", filename);
     73        mr_asprintf(tmp, "File '%s' not found; cannot calc checksum", filename);
    7474        log_it(tmp);
    7575        mr_free(tmp);
     
    142142    assert_string_is_neither_NULL_nor_zerolength(filename);
    143143    if (!does_file_exist(filename)) {
    144         mr_asprintf(&tmp, "%s does not exist, so I cannot found the number of lines in it", filename);
     144        mr_asprintf(tmp, "%s does not exist, so I cannot found the number of lines in it", filename);
    145145        log_it(tmp);
    146146        mr_free(tmp);
    147147        return (0);
    148148    }
    149     mr_asprintf(&command, "cat %s | wc -l", filename);
     149    mr_asprintf(command, "cat %s | wc -l", filename);
    150150    if (!does_file_exist(filename)) {
    151151        mr_free(command);
     
    224224
    225225    assert_string_is_neither_NULL_nor_zerolength(inout);
    226     mr_asprintf(&infname, "%s.in", inout);
    227     mr_asprintf(&outfname, "%s", inout);
    228     mr_asprintf(&tmp, "cp -f %s %s", inout, infname);
     226    mr_asprintf(infname, "%s.in", inout);
     227    mr_asprintf(outfname, "%s", inout);
     228    mr_asprintf(tmp, "cp -f %s %s", inout, infname);
    229229    run_program_and_log_output(tmp, FALSE);
    230230    mr_free(tmp);
     
    251251            fprintf(fout, "%s\n", incoming);
    252252        } else {
    253             mr_asprintf(&tmp, "Excluding '%s'-nonexistent\n", incoming);
     253            mr_asprintf(tmp, "Excluding '%s'-nonexistent\n", incoming);
    254254            log_it(tmp);
    255255            mr_free(tmp);
     
    289289    // If we didn't get anything back, check whether mindi raised a fatal error
    290290    if (!kernel[0]) {
    291         mr_asprintf(&command, "%s", "grep 'Fatal error' /var/log/mindi.log");
    292         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     291        mr_asprintf(command, "%s", "grep 'Fatal error' /var/log/mindi.log");
     292        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    293293        if (strlen(tmp) > 1) {
    294294            popup_and_OK(tmp);
     
    344344
    345345    assert_string_is_neither_NULL_nor_zerolength(fname);
    346     mr_asprintf(&command, "which %s 2> /dev/null", fname);
     346    mr_asprintf(command, "which %s 2> /dev/null", fname);
    347347    strcpy(incoming, call_program_and_get_last_line_of_output(command));
    348348    mr_free(command);
     
    353353            return (NULL);      // forget it :)
    354354        }
    355         mr_asprintf(&command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);
     355        mr_asprintf(command, "file %s 2> /dev/null | cut -d':' -f1 2> /dev/null", incoming);
    356356        strcpy(incoming,
    357357               call_program_and_get_last_line_of_output(command));
     
    360360    if (incoming[0] == '\0')    // yes, it is == '\0' twice, not once :)
    361361    {
    362         mr_asprintf(&command, "dirname %s 2> /dev/null", incoming);
     362        mr_asprintf(command, "dirname %s 2> /dev/null", incoming);
    363363        strcpy(incoming,
    364364               call_program_and_get_last_line_of_output(command));
     
    452452         && !strstr(err_log_lines[i], "% done"); i--);
    453453    if (i < 0) {
    454         mr_asprintf(&command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
     454        mr_asprintf(command, "tail -n3 %s | grep -Fi \"%c\" | tail -n1 | awk '{print $0;}'", filename, '%');
    455455        strcpy(lastline,
    456456               call_program_and_get_last_line_of_output(command));
     
    503503
    504504    if (!does_file_exist(filename)) {
    505         mr_asprintf(&tmp, "Tring to get last line of nonexistent file (%s)", filename);
     505        mr_asprintf(tmp, "Tring to get last line of nonexistent file (%s)", filename);
    506506        log_it(tmp);
    507507        mr_free(tmp);
     
    509509        return (output);
    510510    }
    511     mr_asprintf(&command, "tail -n1 %s", filename);
     511    mr_asprintf(command, "tail -n1 %s", filename);
    512512    fin = popen(command, "r");
    513513    mr_free(command);
     
    602602            stub_fname[i] = '\0';
    603603        }
    604         mr_asprintf(&tmp, "%s%s", comppath, stub_fname);
     604        mr_asprintf(tmp, "%s%s", comppath, stub_fname);
    605605        strcpy(curr_fname, tmp + 1);
    606606        mr_free(tmp);
     
    620620                time_remaining =
    621621                    time_taken * 100 / (long) (percentage) - time_taken;
    622                 mr_asprintf(&tmp, "%02d%% done   %02d:%02d taken   %02d:%02d remaining  %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname);
     622                mr_asprintf(tmp, "%02d%% done   %02d:%02d taken   %02d:%02d remaining  %-37s\r", percentage, (int) (time_taken / 60), (int) (time_taken % 60), (int) (time_remaining / 60), (int) (time_remaining % 60), curr_fname);
    623623                log_to_screen(tmp);
    624624                mr_free(tmp);
     
    645645
    646646    assert_string_is_neither_NULL_nor_zerolength(outdir_fname);
    647     mr_asprintf(&tmp, "mkdir -p %s", outdir_fname);
     647    mr_asprintf(tmp, "mkdir -p %s", outdir_fname);
    648648    res = system(tmp);
    649649    mr_free(tmp);
     
    671671    assert(!strstr(outfile_fname, MNT_CDROM));
    672672    assert(!strstr(outfile_fname, "/dev/cdrom"));
    673     mr_asprintf(&command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname);
     673    mr_asprintf(command, "mkdir -p \"%s\" 2> /dev/null", outfile_fname);
    674674    res += system(command);
    675675    mr_free(command);
    676676
    677     mr_asprintf(&command, "rmdir \"%s\" 2> /dev/null", outfile_fname);
     677    mr_asprintf(command, "rmdir \"%s\" 2> /dev/null", outfile_fname);
    678678    res += system(command);
    679679    mr_free(command);
    680680
    681     mr_asprintf(&command, "rm -f \"%s\" 2> /dev/null", outfile_fname);
     681    mr_asprintf(command, "rm -f \"%s\" 2> /dev/null", outfile_fname);
    682682    res += system(command);
    683683    mr_free(command);
     
    742742    long file_len_K;
    743743
    744     mr_asprintf(&mountlist, "%s/mountlist.txt", tmpdir);
    745     mr_asprintf(&command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);
     744    mr_asprintf(mountlist, "%s/mountlist.txt", tmpdir);
     745    mr_asprintf(command, "grep \"%s \" %s/mountlist.txt | head -n1 | awk '{print $4}'", dev, tmpdir);
    746746    mr_free(mountlist);
    747747
     
    782782    malloc_string(fname);
    783783    log_it("Calculating size of all biggiefiles (in total)");
    784     mr_asprintf(&biggielist, "%s/biggielist.txt", bkpinfo->tmpdir);
     784    mr_asprintf(biggielist, "%s/biggielist.txt", bkpinfo->tmpdir);
    785785    log_it("biggielist = %s", biggielist);
    786786    fin = fopen(biggielist, "r");
     
    801801                        fatal_error("ntfsresize not found");
    802802                    }
    803                     mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname);
     803                    mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", fname);
    804804                    log_it("command = %s", command);
    805                     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     805                    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    806806                    mr_free(command);
    807807
     
    820820                log_msg(4, "%s --> %ld K", fname, file_len_K);
    821821            }
    822             mr_asprintf(&comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
     822            mr_asprintf(comment, "After adding %s, scratchL+%ld now equals %ld", fname, file_len_K, scratchL);
    823823            log_msg(4, comment);
    824824            mr_free(comment);
     
    853853    /*@ end vars *************************************************** */
    854854
    855     mr_asprintf(&command, "du -sk %s", mountpt);
     855    mr_asprintf(command, "du -sk %s", mountpt);
    856856    errno = 0;
    857857    fin = popen(command, "r");
     
    923923    int res = 0;
    924924
    925     mr_asprintf(&command, "which %s > /dev/null 2> /dev/null", fname);
     925    mr_asprintf(command, "which %s > /dev/null 2> /dev/null", fname);
    926926    res = system(command);
    927927    mr_free(command);
    928928
    929929    if (res) {
    930         mr_asprintf(&errorstr, "Please install '%s'. I cannot find it on your system.", fname);
     930        mr_asprintf(errorstr, "Please install '%s'. I cannot find it on your system.", fname);
    931931        log_to_screen(errorstr);
    932932        mr_free(errorstr);
     
    10411041        find_and_store_mondoarchives_home(g_mondo_home);
    10421042    }
    1043     mr_asprintf(&command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir);
     1043    mr_asprintf(command, CP_BIN " --parents -pRdf %s %s", g_mondo_home, bkpinfo->scratchdir);
    10441044
    10451045    log_msg(4, "command = %s", command);
     
    10511051    }
    10521052
    1053     mr_asprintf(&command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
     1053    mr_asprintf(command, "cp -f %s/LAST-FILELIST-NUMBER %s", bkpinfo->tmpdir, bkpinfo->scratchdir);
    10541054    res = run_program_and_log_output(command, FALSE);
    10551055    mr_free(command);
     
    10651065            ("'which mondorestore' returned null. Where's your mondorestore? `which` can't find it. That's odd. Did you install mondorestore?");
    10661066    }
    1067     mr_asprintf(&command, "cp -f %s %s", tmp, bkpinfo->tmpdir);
     1067    mr_asprintf(command, "cp -f %s %s", tmp, bkpinfo->tmpdir);
    10681068    res = run_program_and_log_output(command, FALSE);
    10691069    mr_free(command);
     
    10731073    }
    10741074
    1075     mr_asprintf(&command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir);
     1075    mr_asprintf(command, "hostname > %s/HOSTNAME", bkpinfo->scratchdir);
    10761076    paranoid_system(command);
    10771077    mr_free(command);
    10781078
    10791079    if (bkpinfo->postnuke_tarball[0]) {
    1080         mr_asprintf(&command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir);
     1080        mr_asprintf(command, "cp -f %s %s/post-nuke.tgz", bkpinfo->postnuke_tarball, bkpinfo->tmpdir);
    10811081        res = run_program_and_log_output(command, FALSE);
    10821082        mr_free(command);
     
    11211121
    11221122    log_it("Storing NFS configuration");
    1123     mr_asprintf(&tmp, "%s", bkpinfo->nfs_mount);
     1123    mr_asprintf(tmp, "%s", bkpinfo->nfs_mount);
    11241124    p = strchr(tmp, ':');
    11251125    if (!p) {
     
    11281128    }
    11291129    *(p++) = '\0';
    1130     mr_asprintf(&nfs_server_ipaddr, "%s", tmp);
    1131     mr_asprintf(&nfs_mount, "%s", p);
     1130    mr_asprintf(nfs_server_ipaddr, "%s", tmp);
     1131    mr_asprintf(nfs_mount, "%s", p);
    11321132    mr_free(tmp);
    11331133
    11341134    /* BERLIOS : there is a bug #67 here as it only considers the first NIC */
    1135     mr_asprintf(&command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
    1136     mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    1137     mr_free(command);
    1138 
    1139     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
    1140     mr_asprintf(&nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
    1141     mr_free(command);
    1142 
    1143     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
    1144     mr_asprintf(&nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
    1145     mr_free(command);
    1146 
    1147     mr_asprintf(&command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
    1148     mr_asprintf(&nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
    1149     mr_free(command);
    1150 
    1151     mr_asprintf(&command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
    1152     mr_asprintf(&nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
     1135    mr_asprintf(command, "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\n' | head -n1 | cut -d' ' -f1");
     1136    mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1137    mr_free(command);
     1138
     1139    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f7 | cut -d':' -f2");
     1140    mr_asprintf(nfs_client_ipaddr, "%s", call_program_and_get_last_line_of_output(command));
     1141    mr_free(command);
     1142
     1143    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f9 | cut -d':' -f2");
     1144    mr_asprintf(nfs_client_netmask, "%s", call_program_and_get_last_line_of_output(command));
     1145    mr_free(command);
     1146
     1147    mr_asprintf(command, "%s", "ifconfig | tr '\n' '#' | sed s/##// | tr '#' ' ' | tr '' '\\n' | head -n1 | tr -s '\t' ' ' | cut -d' ' -f8 | cut -d':' -f2");
     1148    mr_asprintf(nfs_client_broadcast, "%s", call_program_and_get_last_line_of_output(command));
     1149    mr_free(command);
     1150
     1151    mr_asprintf(command, "%s", "route -n | grep '^0.0.0.0' | awk '{print $2}'");
     1152    mr_asprintf(nfs_client_defgw, "%s", call_program_and_get_last_line_of_output(command));
    11531153    mr_free(command);
    11541154
     
    11681168    if (!strncmp(nfs_dev, "bond", 4) || !strncmp(nfs_dev, "alb", 3) || !strncmp(nfs_dev, "aft", 3)) {
    11691169        log_to_screen("Found bonding device %s; looking for corresponding ethN slave device\n", nfs_dev);
    1170         mr_asprintf(&command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);
    1171         mr_asprintf(&mac_addr, "%s", call_program_and_get_last_line_of_output(command));
     1170        mr_asprintf(command, "%s", "ifconfig %s | awk '{print $5}' | head -n1", nfs_dev);
     1171        mr_asprintf(mac_addr, "%s", call_program_and_get_last_line_of_output(command));
    11721172        mr_free(command);
    11731173
    1174         mr_asprintf(&command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);
     1174        mr_asprintf(command, "ifconfig | grep -E '%s' | grep -v '%s' | head -n1 | cut -d' ' -f1", mac_addr,nfs_dev);
    11751175        mr_free(mac_addr);
    11761176        mr_free(nfs_dev);
    11771177
    1178         mr_asprintf(&nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
     1178        mr_asprintf(nfs_dev, "%s", call_program_and_get_last_line_of_output(command));
    11791179        mr_free(command);
    11801180
     
    11821182    }
    11831183
    1184     mr_asprintf(&tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
     1184    mr_asprintf(tmp, "%s/NFS-DEV", bkpinfo->tmpdir);
    11851185    write_one_liner_data_file(tmp, nfs_dev);
    11861186    mr_free(nfs_dev);
    11871187    mr_free(tmp);
    11881188
    1189     mr_asprintf(&tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
     1189    mr_asprintf(tmp, "%s/NFS-CLIENT-IPADDR", bkpinfo->tmpdir);
    11901190    write_one_liner_data_file(tmp, nfs_client_ipaddr);
    11911191    mr_free(nfs_client_ipaddr);
    11921192    mr_free(tmp);
    11931193
    1194     mr_asprintf(&tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
     1194    mr_asprintf(tmp, "%s/NFS-CLIENT-NETMASK", bkpinfo->tmpdir);
    11951195    write_one_liner_data_file(tmp, nfs_client_netmask);
    11961196    mr_free(nfs_client_netmask);
    11971197    mr_free(tmp);
    11981198
    1199     mr_asprintf(&tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
     1199    mr_asprintf(tmp, "%s/NFS-CLIENT-BROADCAST", bkpinfo->tmpdir);
    12001200    write_one_liner_data_file(tmp, nfs_client_broadcast);
    12011201    mr_free(nfs_client_broadcast);
    12021202    mr_free(tmp);
    12031203
    1204     mr_asprintf(&tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
     1204    mr_asprintf(tmp, "%s/NFS-CLIENT-DEFGW", bkpinfo->tmpdir);
    12051205    write_one_liner_data_file(tmp, nfs_client_defgw);
    12061206    mr_free(nfs_client_defgw);
    12071207    mr_free(tmp);
    12081208
    1209     mr_asprintf(&tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
     1209    mr_asprintf(tmp, "%s/NFS-SERVER-IPADDR", bkpinfo->tmpdir);
    12101210    write_one_liner_data_file(tmp, nfs_server_ipaddr);
    12111211    mr_free(tmp);
    12121212    mr_free(nfs_server_ipaddr);
    12131213
    1214     mr_asprintf(&tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
     1214    mr_asprintf(tmp, "%s/NFS-SERVER-MOUNT", bkpinfo->tmpdir);
    12151215    write_one_liner_data_file(tmp, bkpinfo->nfs_mount);
    12161216    mr_free(tmp);
    12171217    mr_free(nfs_mount);
    12181218
    1219     mr_asprintf(&tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
     1219    mr_asprintf(tmp, "%s/NFS-SERVER-PATH", bkpinfo->tmpdir);
    12201220    write_one_liner_data_file(tmp, bkpinfo->nfs_remote_dir);
    12211221    mr_free(tmp);
    12221222
    1223     mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     1223    mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    12241224    write_one_liner_data_file(tmp, bkpinfo->prefix);
    12251225    mr_free(tmp);
     
    12821282    if (scratchLL <= 1) {
    12831283        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1284         mr_asprintf(&tmp, "Your backup will probably occupy a single %s. Maybe two.", mds);
     1284        mr_asprintf(tmp, "Your backup will probably occupy a single %s. Maybe two.", mds);
    12851285        mr_free(mds);
    12861286    } else if (scratchLL > 4) {
    1287         mr_asprintf(&tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1)));
     1287        mr_asprintf(tmp, "Your backup will occupy one meeeeellion media! (maybe %s)", number_to_text((int) (scratchLL + 1)));
    12881288    } else {
    1289         mr_asprintf(&tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1)));
     1289        mr_asprintf(tmp, "Your backup will occupy approximately %s media.", number_to_text((int) (scratchLL + 1)));
    12901290    }
    12911291    if (!bkpinfo->image_devs[0] && (scratchLL < 50)) {
     
    13361336    }
    13371337
    1338     mr_asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
     1338    mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    13391339    if (!does_file_exist(tmp)) {
    13401340        mr_free(tmp);
     
    13461346
    13471347    for (p = do_not_compress_these; p != NULL; p++) {
    1348         mr_asprintf(&tmp, "%s", p);
     1348        mr_asprintf(tmp, "%s", p);
    13491349        if (strchr(tmp, ' ')) {
    13501350            *(strchr(tmp, ' ')) = '\0';
     
    13941394        paranoid_fclose(fout);
    13951395        log_msg(2, "Created %s", outfile);
    1396         mr_asprintf(&tmp, "chmod +x %s", outfile);
     1396        mr_asprintf(tmp, "chmod +x %s", outfile);
    13971397        paranoid_system(tmp);
    13981398        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-fork.c

    r2316 r2323  
    125125
    126126    if (bkpinfo->nfs_user) {
    127         mr_asprintf(&tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
     127        mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->nfs_user, basic_call);
    128128    } else {
    129         mr_asprintf(&tmp1, "%s", basic_call);
    130     }
    131 
    132     mr_asprintf(&cd_number_str, "%d", cd_no);
     129        mr_asprintf(tmp1, "%s", basic_call);
     130    }
     131
     132    mr_asprintf(cd_number_str, "%d", cd_no);
    133133    log_msg(4, "basic call = '%s'", tmp1);
    134134    midway_call = resolve_naff_tokens(tmp1, isofile, "_ISO_");
     
    145145
    146146    log_msg(4, "ultimate call = '%s'", ultimate_call);
    147     mr_asprintf(&command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
     147    mr_asprintf(command, "%s >> %s", ultimate_call, MONDO_LOGFILE);
    148148    mr_free(ultimate_call);
    149149
     
    153153            what_i_am_doing);
    154154    if (bkpinfo->manual_cd_tray) {
    155         mr_asprintf(&tmp2, "%s", command);
     155        mr_asprintf(tmp2, "%s", command);
    156156        p = strstr(tmp2, "2>>");
    157157        if (p) {
     
    272272        log_if_failure = TRUE;
    273273    }
    274     mr_asprintf(&callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
     274    mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
    275275    while ((p = strchr(callstr, '\r'))) {
    276276        *p = ' ';
     
    288288    mr_free(callstr);
    289289
    290     mr_asprintf(&callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     290    mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
    291291    if (log_if_failure && system(callstr)) {
    292292        log_OS_error("Command failed");
     
    294294    mr_free(callstr);
    295295
    296     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
     296    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
    297297    unlink(tmp1);
    298298    mr_free(tmp1);
    299299
    300     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
     300    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
    301301    fin = fopen(tmp1, "r");
    302302    if (fin) {
     
    363363    assert_string_is_neither_NULL_nor_zerolength(basic_call);
    364364
    365     mr_asprintf(&lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
    366 
    367     mr_asprintf(&command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
     365    mr_asprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
     366
     367    mr_asprintf(command, "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res", lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
    368368    open_evalcall_form(what_i_am_doing);
    369     mr_asprintf(&tmp, "Executing %s", basic_call);
     369    mr_asprintf(tmp, "Executing %s", basic_call);
    370370    log_msg(2, tmp);
    371371    mr_free(tmp);
     
    373373    if (!(fin = popen(command, "r"))) {
    374374        log_OS_error("Unable to popen-in command");
    375         mr_asprintf(&tmp, "Failed utterly to call '%s'", command);
     375        mr_asprintf(tmp, "Failed utterly to call '%s'", command);
    376376        log_to_screen(tmp);
    377377        mr_free(tmp);
     
    463463        fin = f_orig;
    464464        fout = f_archived;
    465         mr_asprintf(&tmp, "%-64s", PIMP_START_SZ);
     465        mr_asprintf(tmp, "%-64s", PIMP_START_SZ);
    466466        if (fwrite(tmp, 1, 64, fout) != 64) {
    467467            mr_free(tmp);
     
    475475                break;
    476476            }
    477             mr_asprintf(&tmp, "%-64ld", bytes_read_in);
     477            mr_asprintf(tmp, "%-64ld", bytes_read_in);
    478478            if (fwrite(tmp, 1, 64, fout) != 64) {
    479479                mr_free(tmp);
     
    486486                    subsliceno, bytes_read_in, bytes_to_be_read);
    487487            bytes_written_out += fwrite(buf, 1, bytes_read_in, fout);
    488             mr_asprintf(&tmp, "%-64ld", subsliceno);
     488            mr_asprintf(tmp, "%-64ld", subsliceno);
    489489            if (fwrite(tmp, 1, 64, fout) != 64) {
    490490                mr_free(tmp);
     
    495495            subsliceno++;
    496496        }
    497         mr_asprintf(&tmp, "%-64ld", 0L);
     497        mr_asprintf(tmp, "%-64ld", 0L);
    498498        if (fwrite(tmp, 1, 64L, fout) != 64L) {
    499499            mr_free(tmp);
     
    502502        mr_free(tmp);
    503503
    504         mr_asprintf(&tmp, "%-64s", PIMP_END_SZ);
     504        mr_asprintf(tmp, "%-64s", PIMP_END_SZ);
    505505        if (fwrite(tmp, 1, 64, fout) != 64) {
    506506            mr_free(tmp);
     
    559559            log_msg(5, "tmpB is %s", tmp1);
    560560            if (!strstr(tmp1, PIMP_END_SZ)) {
    561                 mr_asprintf(&filestr, "%s/out.leftover", bkpinfo->tmpdir);
     561                mr_asprintf(filestr, "%s/out.leftover", bkpinfo->tmpdir);
    562562                ftmp = fopen(filestr, "w");
    563563                mr_free(filestr);
     
    604604        fatal_error("ntfsclone not found");
    605605    }
    606     mr_asprintf(&command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
     606    mr_asprintf(command, "ntfsclone --force --save-image --overwrite %s %s", output_fname, input_device);
    607607    res = run_program_and_log_output(command, 5);
    608608    mr_free(command);
     
    659659    malloc_string(title);
    660660    strcpy(title, tt);
    661     mr_asprintf(&command, "%s 2>> %s", cmd, MONDO_LOGFILE);
     661    mr_asprintf(command, "%s 2>> %s", cmd, MONDO_LOGFILE);
    662662    log_msg(3, "command = '%s'", command);
    663663    if ((res = pthread_create(&childthread, NULL, run_prog_in_bkgd_then_exit, (void *) command))) {
     
    719719        fatal_error("ntfsclone not found");
    720720    }
    721     mr_asprintf(&command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
     721    mr_asprintf(command, "ntfsclone --force --restore-image --overwrite %s %s", output_device, input_fifo);
    722722    res = run_program_and_log_output(command, 5);
    723723    mr_free(command);
  • branches/2.2.10/mondo/src/common/libmondo-mountlist.c

    r2316 r2323  
    7373    /*@ initialize ***************************************************** */
    7474    prev_part_no = 0;
    75     mr_asprintf(&flaws_str, "%s", "");
     75    mr_asprintf(flaws_str, "%s", "");
    7676
    7777
     
    7979
    8080    if (physical_drive_size < 0) {
    81         mr_asprintf(&tmp, " %s does not exist.", drive);
     81        mr_asprintf(tmp, " %s does not exist.", drive);
    8282        mr_strcat(flaws_str, "%s", tmp);
    8383    } else {
    84         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     84        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    8585    }
    8686    log_it(tmp);
     
    9090    /* check DD */
    9191    for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) {
    92         mr_asprintf(&device, "%s%c", drive, cur_sp_no);
     92        mr_asprintf(device, "%s%c", drive, cur_sp_no);
    9393        if (find_device_in_mountlist(mountlist, device) >= 0) {
    9494            foundsome = TRUE;
     
    9898    if (foundsome) {
    9999        for (cur_sp_no = 'a'; cur_sp_no < 'z'; ++cur_sp_no) {
    100             mr_asprintf(&device, "%s%c", drive, cur_sp_no);
     100            mr_asprintf(device, "%s%c", drive, cur_sp_no);
    101101            pos = find_device_in_mountlist(mountlist, device);
    102102            if (pos < 0) {
     
    107107            /* is it too big? */
    108108            if (curr_part_no > 'h') {
    109                 mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     109                mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    110110                log_it(tmp);
    111111                mr_strcat(flaws_str, tmp);
     
    121121            }
    122122            if (device_copies > 1) {
    123                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     123                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    124124                if (!strstr(flaws_str, tmp)) {
    125125                    log_it(tmp);
     
    132132            if (mountlist->el[pos].size < 8192
    133133                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    134                 mr_asprintf(&tmp, " %s is tiny!", device);
     134                mr_asprintf(tmp, " %s is tiny!", device);
    135135                log_it(tmp);
    136136                mr_strcat(flaws_str, tmp);
     
    145145                && strcmp(mountlist->el[pos].mountpoint, "none")
    146146                && mountlist->el[pos].mountpoint[0] != '/') {
    147                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     147                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    148148                log_it(tmp);
    149149                mr_strcat(flaws_str, tmp);
     
    153153            /* is format sensible? */
    154154            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    155                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     155                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    156156                log_it(tmp);
    157157                mr_strcat(flaws_str, tmp);
     
    172172        npos = 0;
    173173        for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) {
    174             mr_asprintf(&tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);
     174            mr_asprintf(tmp, "%ss%i%c", device, curr_part_no, cur_sp_no);
    175175            if (find_device_in_mountlist(mountlist, tmp) >= 0) {
    176176                npos++;
     
    191191            if (curr_part_no - prev_part_no > 1) {
    192192                if (prev_part_no == 0) {
    193                     mr_asprintf(&tmp, " Gap prior to %s.", device);
     193                    mr_asprintf(tmp, " Gap prior to %s.", device);
    194194                    log_it(tmp);
    195195                    mr_strcat(flaws_str, "%s", tmp);
     
    198198                } else if (curr_part_no > 5
    199199                           || (curr_part_no <= 4 && prev_part_no > 0)) {
    200                     mr_asprintf(&tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
     200                    mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
    201201                    log_it(tmp);
    202202                    mr_strcat(flaws_str, "%s", tmp);
     
    210210            if ((curr_part_no >= 5 && prev_part_no == 4)
    211211                && (strcmp(part_table_fmt, "MBR") == 0)) {
    212                 mr_asprintf(&tmp, " Partition %ss4 is occupied.", drive);
     212                mr_asprintf(tmp, " Partition %ss4 is occupied.", drive);
    213213                log_it(tmp);
    214214                mr_strcat(flaws_str, "%s", tmp);
     
    224224            }
    225225            if (device_copies > 1) {
    226                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     226                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    227227                if (!strstr(flaws_str, "%s", tmp)) {
    228228                    log_it(tmp);
     
    235235            if (mountlist->el[pos].size < 8192
    236236                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    237                 mr_asprintf(&tmp, " %s is tiny!", device);
     237                mr_asprintf(tmp, " %s is tiny!", device);
    238238                log_it(tmp);
    239239                mr_strcat(flaws_str, "%s", tmp);
     
    248248                && strcmp(mountlist->el[pos].mountpoint, "none")
    249249                && mountlist->el[pos].mountpoint[0] != '/') {
    250                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     250                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    251251                log_it(tmp);
    252252                mr_strcat(flaws_str, "%s", tmp);
     
    256256            /* is format sensible? */
    257257            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    258                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     258                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    259259                log_it(tmp);
    260260                mr_strcat(flaws_str, "%s", tmp);
     
    274274                /* is it too big? */
    275275                if (curr_part_no > 'h') {
    276                     mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     276                    mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    277277                    log_it(tmp);
    278278                    mr_strcat(flaws_str, "%s", tmp);
     
    288288                }
    289289                if (device_copies > 1) {
    290                     mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     290                    mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    291291                    if (!strstr(flaws_str, tmp)) {
    292292                        log_it(tmp);
     
    299299                if (mountlist->el[pos].size < 8192
    300300                    && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    301                     mr_asprintf(&tmp, " %s is tiny!", device);
     301                    mr_asprintf(tmp, " %s is tiny!", device);
    302302                    log_it(tmp);
    303303                    mr_strcat(flaws_str, "%s", tmp);
     
    312312                    && strcmp(mountlist->el[pos].mountpoint, "none")
    313313                    && mountlist->el[pos].mountpoint[0] != '/') {
    314                     mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     314                    mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    315315                    log_it(tmp);
    316316                    mr_strcat(flaws_str, "%s", tmp);
     
    321321                if (!is_this_a_valid_disk_format
    322322                    (mountlist->el[pos].format)) {
    323                     mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     323                    mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    324324                    log_it(tmp);
    325325                    mr_strcat(flaws_str, "%s", tmp);
     
    341341    if (amount_allocated > physical_drive_size) // Used to be +1, but what if you're 1 MB too high?
    342342    {
    343         mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     343        mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    344344                amount_allocated - physical_drive_size, drive);
    345345        log_it(tmp);
     
    348348        res++;
    349349    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    350         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     350        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    351351                physical_drive_size - amount_allocated, drive);
    352352        log_it(tmp);
     
    389389    assert_string_is_neither_NULL_nor_zerolength(drive);
    390390    assert(mountlist != NULL);
    391     mr_asprintf(&flaws_str, "%s", "");
     391    mr_asprintf(flaws_str, "%s", "");
    392392
    393393    prev_part_no = 0;
     
    396396
    397397    if (physical_drive_size < 0) {
    398         mr_asprintf(&tmp, " %s does not exist.", drive);
     398        mr_asprintf(tmp, " %s does not exist.", drive);
    399399        mr_strcat(flaws_str, "%s", tmp);
    400400        res++;
     
    403403        return(flaws_str);
    404404    } else {
    405         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     405        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    406406        log_it(tmp);
    407407        mr_free(tmp);
     
    417417        if (curr_part_no - prev_part_no > 1) {
    418418            if (prev_part_no == 0) {
    419                 mr_asprintf(&tmp, " Gap prior to %s.", device);
     419                mr_asprintf(tmp, " Gap prior to %s.", device);
    420420                log_it(tmp);
    421421                mr_strcat(flaws_str, "%s", tmp);
     
    424424            } else if (curr_part_no > 5
    425425                       || (curr_part_no <= 4 && prev_part_no > 0)) {
    426                 mr_asprintf(&tmp, " Gap on %s between %d and %d.", drive,
     426                mr_asprintf(tmp, " Gap on %s between %d and %d.", drive,
    427427                        prev_part_no, curr_part_no);
    428428                log_it(tmp);
     
    437437        if ((curr_part_no >= 5 && prev_part_no == 4)
    438438            && (strcmp(part_table_fmt, "MBR") == 0)) {
    439             mr_asprintf(&tmp, " Partition 4 of %s is occupied.", drive);
     439            mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive);
    440440            log_it(tmp);
    441441            mr_strcat(flaws_str, "%s", tmp);
     
    451451        }
    452452        if (device_copies > 1) {
    453             mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     453            mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    454454            if (!strstr(flaws_str, tmp)) {
    455455                log_it(tmp);
     
    462462        if (mountlist->el[pos].size < 8192
    463463            && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    464             mr_asprintf(&tmp, " %s is tiny!", device);
     464            mr_asprintf(tmp, " %s is tiny!", device);
    465465            log_it(tmp);
    466466            mr_strcat(flaws_str, "%s", tmp);
     
    474474            && strcmp(mountlist->el[pos].mountpoint, "image")
    475475            && mountlist->el[pos].mountpoint[0] != '/') {
    476             mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     476            mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    477477            log_it(tmp);
    478478            mr_strcat(flaws_str, "%s", tmp);
     
    482482        /* is format sensible? */
    483483        if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    484             mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     484            mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    485485            log_it(tmp);
    486486            mr_strcat(flaws_str, "%s", tmp);
     
    496496    /* Over-allocated the disk? Unallocated space on disk? */
    497497    if (amount_allocated > physical_drive_size + 1) {
    498         mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     498        mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    499499                amount_allocated - physical_drive_size, drive);
    500500        log_it(tmp);
     
    503503        res++;
    504504    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    505         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     505        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    506506                physical_drive_size - amount_allocated, drive);
    507507        log_it(tmp);
     
    551551    assert(flaws_str_C != NULL);
    552552
    553     mr_asprintf(&flaws_str, "%s", "");
     553    mr_asprintf(flaws_str, "%s", "");
    554554
    555555    make_list_of_drives_in_mountlist(mountlist, drivelist);
     
    561561            (drivelist->el[i].device,
    562562             DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) {
    563             mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
     563            mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    564564            log_it(tmp);
    565565            paranoid_free(tmp);
     
    639639
    640640    for (currline = 0; currline < mountlist->entries; currline++) {
    641         mr_asprintf(&curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
     641        mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
    642642        for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries;
    643643             i++) {
     
    651651        if (copies > 1 && last_copy == currline
    652652            && strcmp(curr_mountpoint, "raid")) {
    653             mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
     653            mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    654654            mr_strcat(flaws_str, "%s", tmp);
    655655            log_it(tmp);
     
    690690    for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) {
    691691
    692         mr_asprintf(&drive, "%s", mountlist->el[lino].device);
     692        mr_asprintf(drive, "%s", mountlist->el[lino].device);
    693693        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    694694            log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
     
    777777                       (void *) &mountlist->el[i],
    778778                       sizeof(struct mountlist_line));
    779                 mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
     779                mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    780780                log_it(tmp);
    781781                paranoid_free(tmp);
     
    895895            if (j < items) {
    896896                strcat(mountlist->el[items].device, "_dup");
    897                 mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
     897                mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    898898                log_it(tmp);
    899899                paranoid_free(tmp);
    900900            }
    901             mr_asprintf(&tmp, "%s", mountlist->el[items].device);
     901            mr_asprintf(tmp, "%s", mountlist->el[items].device);
    902902            if (strstr(tmp, "/dev/md/")) {
    903903                log_it("format_device() --- Contracting %s", tmp);
     
    10481048    assert(b >= 0);
    10491049
    1050     mr_asprintf(&device, "%s", mountlist->el[a].device);
    1051     mr_asprintf(&mountpoint, "%s", mountlist->el[a].mountpoint);
    1052     mr_asprintf(&format, "%s", mountlist->el[a].format);
     1050    mr_asprintf(device, "%s", mountlist->el[a].device);
     1051    mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint);
     1052    mr_asprintf(format, "%s", mountlist->el[a].format);
    10531053
    10541054    size = mountlist->el[a].size;
  • branches/2.2.10/mondo/src/common/libmondo-raid.c

    r2321 r2323  
    5050    int res;
    5151
    52     mr_asprintf(&command, "grep \"");
     52    mr_asprintf(command, "grep \"");
    5353    if (raidno == -1) {
    5454        mr_strcat(command, "linear");
     
    197197    assert(label != NULL);
    198198
    199     mr_asprintf(&sz_value, "%d", value);
     199    mr_asprintf(sz_value, "%d", value);
    200200    strcpy(raidrec->additional_vars.el[lino].label, label);
    201201    strcpy(raidrec->additional_vars.el[lino].value, sz_value);
     
    585585    fclose(fin);
    586586    log_it("Raidtab loaded successfully.");
    587     mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries);
     587    mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries);
    588588    log_it(tmp1);
    589589    mr_free(tmp1);
     
    744744        }
    745745        if (!disklist) {
    746             mr_asprintf(&tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
     746            mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    747747            log_it(tmp);
    748748            mr_free(tmp);
     
    10061006    pos = string;
    10071007    while (*pos == ' ') pos += 1;
    1008     mr_asprintf(&strtmp, "%s", pos);
     1008    mr_asprintf(strtmp, "%s", pos);
    10091009    strcpy(string, strtmp);
    10101010    paranoid_free(strtmp);
     
    10271027    token = mr_strtok(string, delims, &lastpos);
    10281028    // get RAID device name
    1029     mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1029    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10301030    strcpy(raidlist->el[raidlist->entries].raid_device, strtmp);
    10311031    paranoid_free(strtmp);
     
    10861086      case ' ': // normal data disks
    10871087        raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1);
    1088         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1088        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10891089        strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp);
    10901090        paranoid_free(strtmp);
     
    10931093      case 'S': // spare disks
    10941094        raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1);
    1095         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1095        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10961096        strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp);
    10971097        paranoid_free(strtmp);
     
    11001100      case 'F': // failed disks
    11011101        raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1);
    1102         mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1102        mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11031103        strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp);
    11041104        paranoid_free(strtmp);
  • branches/2.2.10/mondo/src/common/libmondo-stream.c

    r2321 r2323  
    236236    int res;
    237237
    238     mr_asprintf(&command, "mt -f %s status", dev);
     238    mr_asprintf(command, "mt -f %s status", dev);
    239239    res = run_program_and_log_output(command, 1);
    240240    mr_free(command);
     
    268268        mr_asprintf(&cdr_exe, "dvdrecord");
    269269    }
    270     mr_asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);
     270    mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l", cdr_exe);
    271271    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    272272    mr_free(command);
     
    280280    mr_free(tmp);
    281281
    282     mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);
     282    mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f2 | head -n1", cdr_exe);
    283283    mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
    284284    mr_free(command);
     
    290290    }
    291291    mr_free(tmp);
    292     mr_asprintf(&command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
     292    mr_asprintf(command, "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -i TAPE | cut -d' ' -f3 | cut -d')' -f1 | head -n1", cdr_exe);
    293293    mr_free(cdr_exe);
    294294
     
    372372        }
    373373        if (strstr(fname, "xattr") == NULL) {
    374             mr_asprintf(&tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
     374            mr_asprintf(tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
    375375            fatal_error(tmp);
    376376        }
     
    402402        }
    403403        if (strstr(fname, "acl") == NULL) {
    404             mr_asprintf(&tmp,"Wrong order expected acl, got %s, sunshine.", fname);
     404            mr_asprintf(tmp,"Wrong order expected acl, got %s, sunshine.", fname);
    405405            fatal_error(tmp);
    406406        }
     
    468468    log_it("Insisting on tape #%d", tapeno);
    469469    if (g_current_media_number != tapeno) {
    470         mr_asprintf(&tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);
     470        mr_asprintf(tmp, "When the tape drive goes quiet, please insert volume %d in this series.", tapeno);
    471471        popup_and_OK(tmp);
    472472        mr_free(tmp);
     
    544544        fatal_error("Unknown type. Internal error in maintain_collection_of_recent_archives()");
    545545    }
    546     mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir);
     546    mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", bkpinfo->tmpdir);
    547547    mkdir(tmpdir, 0x700);
    548     mr_asprintf(&command, "cp -f %s %s", latest_fname, tmpdir);
     548    mr_asprintf(command, "cp -f %s %s", latest_fname, tmpdir);
    549549    if (run_program_and_log_output(command, 6)) {
    550550        log_it("Warning - failed to copy %s to backcatalog at %s",
     
    575575
    576576    for (i = curr - 1; i >= 0 && curr - i < 10; i--) {
    577         mr_asprintf(&old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
     577        mr_asprintf(old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
    578578        unlink(old_fname);
    579579        mr_free(old_fname);
     
    615615        return (0);
    616616    }
    617     mr_asprintf(&tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
     617    mr_asprintf(tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
    618618    res = run_program_and_log_output(tmp, 3);
    619619    mr_free(tmp);
     
    684684
    685685    log_it("Skipping OBDR headers");
    686     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     686    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    687687    res = run_program_and_log_output(command, 1);
    688688    paranoid_free(command);
    689689
    690     mr_asprintf(&command, "mt -f %s fsf 2",bkpinfo->media_device);
     690    mr_asprintf(command, "mt -f %s fsf 2",bkpinfo->media_device);
    691691    res = run_program_and_log_output(command, 1);
    692692    paranoid_free(command);
     
    711711    log_it("Creating OBDR headers");
    712712    /* OBDR: First block 10 kB of zero bs = 512 */
    713     mr_asprintf(&command, "mt -f %s compression off",bkpinfo->media_device);
     713    mr_asprintf(command, "mt -f %s compression off",bkpinfo->media_device);
    714714    res = run_program_and_log_output(command, 1);
    715715    paranoid_free(command);
    716716
    717     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     717    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    718718    res += run_program_and_log_output(command, 1);
    719719    paranoid_free(command);
     
    721721    set_tape_block_size_with_mt(512);
    722722
    723     mr_asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
     723    mr_asprintf(command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
    724724    res += run_program_and_log_output(command, 1);
    725725    paranoid_free(command);
     
    728728    set_tape_block_size_with_mt(2048);
    729729
    730     mr_asprintf(&command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
     730    mr_asprintf(command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
    731731    res += run_program_and_log_output(command, 1);
    732732    paranoid_free(command);
     
    795795
    796796    insist_on_this_tape_number(1);
    797     mr_asprintf(&outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
     797    mr_asprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
    798798    make_hole_for_file(outfname);
    799799
     
    858858    (void) getcwd(old_cwd, MAX_STR_LEN);
    859859    chdir(bkpinfo->tmpdir);
    860     mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
     860    mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null", outfname);
    861861    paranoid_system(tmp);
    862862    mr_free(tmp);
     
    885885
    886886    /*  add 'dummy' if testing */
    887     mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
     887    mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
    888888    /*  initialise the catalog */
    889889    g_current_media_number = 1;
     
    10581058    res = read_header_block_from_stream(&temp_size, temp_fname, &ctrl_chr);
    10591059    if (orig_size != temp_size && orig_size != -1) {
    1060         mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     1060        mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    10611061        log_to_screen(tmp);
    10621062        mr_free(tmp);
     
    11211121    log_msg(6, ".......................... Should be %lld", orig_size);
    11221122    g_tape_posK += total_read_from_tape_for_this_file / 1024;
    1123     mr_asprintf(&actual_cksum, "%04x%04x", crc16, crctt);
     1123    mr_asprintf(actual_cksum, "%04x%04x", crc16, crctt);
    11241124    if (foutstream) {           /*log_it("Finished writing to foutstream"); */
    11251125    } else {
     
    11311131    }
    11321132    if (strcmp(temp_cksum, actual_cksum)) {
    1133         mr_asprintf(&tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
     1133        mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum, temp_cksum);
    11341134        log_to_screen(tmp);
    11351135        mr_free(tmp);
    11361136
    1137         mr_asprintf(&tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
     1137        mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname, (long) orig_size >> 10);
    11381138        log_to_screen(tmp);
    11391139        mr_free(tmp);
     
    14861486    }
    14871487    if (bkpinfo->backup_media_type == cdstream) {
    1488         mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);
     1488        mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE, MONDO_LOGFILE);
    14891489        log_it("Opening OUT to next CD with the command");
    14901490        log_it(command);
     
    15381538    last = g_tapecatalog->entries - 1;
    15391539    for (i = 0; i <= last; i++) {
    1540         mr_asprintf(&fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
     1540        mr_asprintf(fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
    15411541        if (!does_file_exist(fname)) {
    15421542            log_msg(6, "Can't write %s - it doesn't exist.", fname);
     
    15911591    log_it("Data disks = %s", fname);
    15921592    if (!does_file_exist(fname)) {
    1593         mr_asprintf(&tmp, "Cannot find %s", fname);
     1593        mr_asprintf(tmp, "Cannot find %s", fname);
    15941594        log_to_screen(tmp);
    15951595        mr_free(tmp);
     
    16891689        p++;
    16901690    }
    1691     mr_asprintf(&tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
     1691    mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p, (long) filesize >> 10);
    16921692    log_it(tmp);
    16931693    mr_free(tmp);
     
    17311731    }
    17321732    paranoid_fclose(fin);
    1733     mr_asprintf(&checksum, "%04x%04x", crc16, crctt);
     1733    mr_asprintf(checksum, "%04x%04x", crc16, crctt);
    17341734    /* BERLIOS: what does it do ??? */
    17351735    write_header_block_to_stream((off_t)g_current_media_number, checksum, BLK_STOP_FILE);
     
    17941794        fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    17951795               g_tape_stream) / 1024;
    1796     mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
     1796    mr_asprintf(tmp, "%s (fname=%s, size=%ld K)", marker_to_string(control_char), p, (long) length_of_incoming_file >> 10);
    17971797    log_msg(6, tmp);
    17981798    mr_free(tmp);
     
    18211821
    18221822    /*@ end vars *************************************************** */
    1823     mr_asprintf(&tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
     1823    mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    18241824    log_to_screen(tmp);
    18251825    mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-string.c

    r2322 r2323  
    4545    assert(partno >= 0);
    4646
    47     mr_asprintf(&partition, drive);
     47    mr_asprintf(partition, drive);
    4848    /* is this a devfs device path? */
    4949    c = strrchr(partition, '/');
     
    241241        fatal_error("Integer overflow.");
    242242    } else if (ch != 'm' && ch != 'M') {
    243         mr_asprintf(&tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);
     243        mr_asprintf(tmp1, "Re: parameter '%s' - bad multiplier ('%c')", incoming, ch);
    244244        fatal_error(tmp1);
    245245    }
     
    420420        p = ' ';
    421421    }
    422     mr_asprintf(&output, "%d %s disk%c", noof_disks, label, p);
     422    mr_asprintf(output, "%d %s disk%c", noof_disks, label, p);
    423423    while (strlen(output) < 14) {
    424424        mr_strcat(output, " ");
     
    511511            mr_strcat(output, "%s%s", q, value);
    512512        } else {
    513             mr_asprintf(&output, "%s%s", q, value);
     513            mr_asprintf(output, "%s%s", q, value);
    514514        }
    515515        p+= strlen(token);
     
    520520    } else {
    521521        /* just in case the token doesn't appear in string at all */
    522         mr_asprintf(&output, "%s", q);
     522        mr_asprintf(output, "%s", q);
    523523    }
    524524    return(output);
     
    555555    assert_string_is_neither_NULL_nor_zerolength(path);
    556556    if (s[0] != '\0') {
    557         mr_asprintf(&suffix, ".%s", s);
     557        mr_asprintf(suffix, ".%s", s);
    558558    } else {
    559         mr_asprintf(&suffix, "");
     559        mr_asprintf(suffix, "");
    560560    }
    561561    sprintf(output, "%s/slice-%07ld.%05ld.dat%s", path, bigfileno, sliceno, suffix);
     
    622622    if (strlen(flaws_str) > 0) {
    623623        paranoid_free(flaws_str_A);
    624         mr_asprintf(&flaws_str_A, "%s", flaws_str + 1);
     624        mr_asprintf(flaws_str_A, "%s", flaws_str + 1);
    625625    }
    626626    if (strlen(flaws_str_A) >= 74) {
    627627        for (i = 74; flaws_str_A[i] != ' '; i--);
    628628        paranoid_free(flaws_str_B);
    629         mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
     629        mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1);
    630630        flaws_str_A[i] = '\0';
    631631    }
     
    633633        for (i = 74; flaws_str_B[i] != ' '; i--);
    634634        paranoid_free(flaws_str_C);
    635         mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
     635        mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1);
    636636        flaws_str_B[i] = '\0';
    637637    }
     
    830830
    831831    assert_string_is_neither_NULL_nor_zerolength(partition);
    832     mr_asprintf(&trunc, "%s", partition);
     832    mr_asprintf(trunc, "%s", partition);
    833833
    834834#ifdef __FreeBSD__
     
    931931    assert_string_is_neither_NULL_nor_zerolength(fn);
    932932    if (!strncmp(fn, MNT_RESTORING, strlen(MNT_RESTORING))) {
    933         mr_asprintf(&filename, "%s", fn + strlen(MNT_RESTORING));
     933        mr_asprintf(filename, "%s", fn + strlen(MNT_RESTORING));
    934934    } else if (fn[0] != '/') {
    935         mr_asprintf(&filename, "/%s", fn);
     935        mr_asprintf(filename, "/%s", fn);
    936936    } else {
    937         mr_asprintf(&filename, "%s", fn);
     937        mr_asprintf(filename, "%s", fn);
    938938    }
    939939
    940940    sev = 3;
    941     mr_asprintf(&reason, "Changed since backup. Consider running a differential backup in a day or two.");
     941    mr_asprintf(reason, "Changed since backup. Consider running a differential backup in a day or two.");
    942942
    943943    if (!strncmp(filename, "/var/", 5)) {
    944944        sev = 2;
    945945        mr_free(reason);
    946         mr_asprintf(&reason, "/var's contents will change regularly, inevitably.");
     946        mr_asprintf(reason, "/var's contents will change regularly, inevitably.");
    947947    }
    948948    if (!strncmp(filename, "/home", 5)) {
    949949        sev = 2;
    950950        mr_free(reason);
    951         mr_asprintf(&reason, "It's in your /home directory. Therefore, it is important.");
     951        mr_asprintf(reason, "It's in your /home directory. Therefore, it is important.");
    952952    }
    953953    if (!strncmp(filename, "/usr/", 5)) {
    954954        sev = 3;
    955955        mr_free(reason);
    956         mr_asprintf(&reason, "You may have installed/removed software during the backup.");
     956        mr_asprintf(reason, "You may have installed/removed software during the backup.");
    957957    }
    958958    if (!strncmp(filename, "/etc/", 5)) {
    959959        sev = 3;
    960960        mr_free(reason);
    961         mr_asprintf(&reason, "Do not edit config files while backing up your PC.");
     961        mr_asprintf(reason, "Do not edit config files while backing up your PC.");
    962962    }
    963963    if (!strcmp(filename, "/etc/adjtime")
     
    965965        sev = 1;
    966966        mr_free(reason);
    967         mr_asprintf(&reason, "This file changes all the time. It's OK.");
     967        mr_asprintf(reason, "This file changes all the time. It's OK.");
    968968    }
    969969    if (!strncmp(filename, "/root/", 6)) {
    970970        sev = 3;
    971971        mr_free(reason);
    972         mr_asprintf(&reason, "Were you compiling/editing something in /root?");
     972        mr_asprintf(reason, "Were you compiling/editing something in /root?");
    973973    }
    974974    if (!strncmp(filename, "/root/.", 7)) {
    975975        sev = 2;
    976976        mr_free(reason);
    977         mr_asprintf(&reason, "Temp or 'dot' files changed in /root.");
     977        mr_asprintf(reason, "Temp or 'dot' files changed in /root.");
    978978    }
    979979    if (!strncmp(filename, "/var/lib/", 9)) {
    980980        sev = 2;
    981981        mr_free(reason);
    982         mr_asprintf(&reason, "Did you add/remove software during backing?");
     982        mr_asprintf(reason, "Did you add/remove software during backing?");
    983983    }
    984984    if (!strncmp(filename, "/var/lib/rpm", 12)) {
    985985        sev = 3;
    986986        mr_free(reason);
    987         mr_asprintf(&reason, "Did you add/remove software during backing?");
     987        mr_asprintf(reason, "Did you add/remove software during backing?");
    988988    }
    989989    if (!strncmp(filename, "/var/lib/slocate", 16)) {
    990990        sev = 1;
    991991        mr_free(reason);
    992         mr_asprintf(&reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
     992        mr_asprintf(reason, "The 'update' daemon ran during backup. This does not affect the integrity of your backup.");
    993993    }
    994994    if (!strncmp(filename, "/var/log/", 9)
     
    997997        sev = 1;
    998998        mr_free(reason);
    999         mr_asprintf(&reason, "Log files change frequently as the computer runs. Fret not.");
     999        mr_asprintf(reason, "Log files change frequently as the computer runs. Fret not.");
    10001000    }
    10011001    if (!strncmp(filename, "/var/spool", 10)) {
    10021002        sev = 1;
    10031003        mr_free(reason);
    1004         mr_asprintf(&reason, "Background processes or printers were active. This does not affect the integrity of your backup.");
     1004        mr_asprintf(reason, "Background processes or printers were active. This does not affect the integrity of your backup.");
    10051005    }
    10061006    if (!strncmp(filename, "/var/spool/mail", 10)) {
    10071007        sev = 2;
    10081008        mr_free(reason);
    1009         mr_asprintf(&reason, "Mail was sent/received during backup.");
     1009        mr_asprintf(reason, "Mail was sent/received during backup.");
    10101010    }
    10111011    if (filename[strlen(filename) - 1] == '~') {
    10121012        sev = 1;
    10131013        mr_free(reason);
    1014         mr_asprintf(&reason, "Backup copy of another file which was modified recently.");
     1014        mr_asprintf(reason, "Backup copy of another file which was modified recently.");
    10151015    }
    10161016    if (strstr(filename, "cache")) {
    10171017        sev = 1;
    10181018        mr_free(reason);
    1019         mr_asprintf(&reason, "Part of a cache of data. Caches change from time to time. Don't worry.");
     1019        mr_asprintf(reason, "Part of a cache of data. Caches change from time to time. Don't worry.");
    10201020    }
    10211021    if (!strncmp(filename, "/var/run/", 9)
     
    10251025        sev = 1;
    10261026        mr_free(reason);
    1027         mr_asprintf(&reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
     1027        mr_asprintf(reason, "Temporary file (a lockfile, perhaps) used by software such as X or KDE to register its presence.");
    10281028    }
    10291029    if (out_reason) {
     
    10881088
    10891089    if (bkpinfo->media_size[g_current_media_number] <= 0) {
    1090         mr_asprintf(&tmp, "%lld", g_tape_posK);
    1091         mr_asprintf(&pos_w_commas, "%s", commarize(tmp));
     1090        mr_asprintf(tmp, "%lld", g_tape_posK);
     1091        mr_asprintf(pos_w_commas, "%s", commarize(tmp));
    10921092        mr_free(tmp);
    1093         mr_asprintf(&outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);
     1093        mr_asprintf(outstr, "Volume %d: %s kilobytes archived so far", g_current_media_number, pos_w_commas);
    10941094        mr_free(pos_w_commas);
    10951095        return (outstr);
     
    11041104            percentage = 100;
    11051105        }
    1106         mr_asprintf(&outstr, "Volume %d: [", g_current_media_number);
     1106        mr_asprintf(outstr, "Volume %d: [", g_current_media_number);
    11071107    } else {
    11081108        percentage =
     
    11101110                   bkpinfo->media_size[g_current_media_number]);
    11111111        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1112         mr_asprintf(&outstr, "%s %d: [", mds, g_current_media_number);
     1112        mr_asprintf(outstr, "%s %d: [", mds, g_current_media_number);
    11131113        mr_free(mds);
    11141114    }
     
    11361136    switch (type_of_bkp) {
    11371137    case dvd:
    1138         mr_asprintf(&type_of_backup, "DVD");
     1138        mr_asprintf(type_of_backup, "DVD");
    11391139        break;
    11401140    case cdr:
    1141         mr_asprintf(&type_of_backup, "CDR");
     1141        mr_asprintf(type_of_backup, "CDR");
    11421142        break;
    11431143    case cdrw:
    1144         mr_asprintf(&type_of_backup, "CDRW");
     1144        mr_asprintf(type_of_backup, "CDRW");
    11451145        break;
    11461146    case tape:
    1147         mr_asprintf(&type_of_backup, "tape");
     1147        mr_asprintf(type_of_backup, "tape");
    11481148        break;
    11491149    case cdstream:
    1150         mr_asprintf(&type_of_backup, "CDR");
     1150        mr_asprintf(type_of_backup, "CDR");
    11511151        break;
    11521152    case udev:
    1153         mr_asprintf(&type_of_backup, "udev");
     1153        mr_asprintf(type_of_backup, "udev");
    11541154        break;
    11551155    case iso:
    1156         mr_asprintf(&type_of_backup, "ISO");
     1156        mr_asprintf(type_of_backup, "ISO");
    11571157        break;
    11581158    case nfs:
    1159         mr_asprintf(&type_of_backup, "nfs");
     1159        mr_asprintf(type_of_backup, "nfs");
    11601160        break;
    11611161    case usb:
    1162         mr_asprintf(&type_of_backup, "USB");
     1162        mr_asprintf(type_of_backup, "USB");
    11631163        break;
    11641164    default:
    1165         mr_asprintf(&type_of_backup, "ISO");
     1165        mr_asprintf(type_of_backup, "ISO");
    11661166    }
    11671167    return (type_of_backup);
  • branches/2.2.10/mondo/src/common/libmondo-tools.c

    r2322 r2323  
    219219
    220220    uname(&utsn);
    221     mr_asprintf(&tmp, "%s", utsn.machine);
     221    mr_asprintf(tmp, "%s", utsn.machine);
    222222    return (tmp);
    223223}
     
    449449    if (bkpinfo->backup_media_type == tape) {
    450450        log_msg(1, "Bar");
    451         mr_asprintf(&tmp, "mt -f %s status", bkpinfo->media_device);
     451        mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device);
    452452        log_msg(1, "tmp = '%s'", tmp);
    453453        if (run_program_and_log_output(tmp, 3)) {
     
    501501        }
    502502        if (bkpinfo->nonbootable_backup) {
    503             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
     503            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
    504504        } else if
    505505#ifdef __FreeBSD__
     
    510510#ifdef __IA64__
    511511    {
    512         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
     512        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
    513513    }
    514514#else
    515515    {
    516         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
     516        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
    517517    }
    518518#endif
    519519        else
    520520        {
    521             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
     521            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
    522522        }
    523523        if (bkpinfo->manual_cd_tray) {
     
    533533        }
    534534        if (getenv ("SUDO_COMMAND")) {
    535             mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND");
     535            mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND");
    536536            if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) {
    537537                mr_free(command);
     
    549549        || bkpinfo->backup_media_type == cdr) {
    550550        if (!bkpinfo->manual_cd_tray) {
    551             mr_asprintf(&extra_cdrom_params, "-waiti ");
     551            mr_asprintf(extra_cdrom_params, "-waiti ");
    552552        }
    553553        if (bkpinfo->backup_media_type == cdrw) {
    554             mr_asprintf(&extra_cdrom_params, "blank=fast ");
     554            mr_asprintf(extra_cdrom_params, "blank=fast ");
    555555        }
    556556        if (find_home_of_exe("cdrecord")) {
     
    562562        }
    563563        if (bkpinfo->nonbootable_backup) {
    564             mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);
     564            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_NONBOOT);
    565565        } else if
    566566#ifdef __FreeBSD__
     
    571571#ifdef __IA64__
    572572    {
    573         mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);
     573        mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_ELILO);
    574574    }
    575575#else
    576576    {
    577         mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);
     577        mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_LILO);
    578578    }
    579579#endif
    580580        else
    581581        {
    582             mr_asprintf(&mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);
     582            mr_asprintf(mondo_mkisofs_sz, MONDO_MKISOFS_REGULAR_SYSLINUX);
    583583        }
    584584        if (bkpinfo->manual_cd_tray) {
     
    621621
    622622        log_it("isodir = %s", bkpinfo->isodir);
    623         mr_asprintf(&command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);
     623        mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1", bkpinfo->isodir);
    624624        log_it("command = %s", command);
    625625        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    626         mr_asprintf(&iso_dev, "%s", call_program_and_get_last_line_of_output(command));
    627         mr_asprintf(&tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
     626        mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command));
     627        mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
    628628        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    629629        mr_free(tmp);
    630630        mr_free(command);
    631631
    632         mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
     632        mr_asprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
    633633        mr_free(iso_dev);
    634634
    635635        log_it("command = %s", command);
    636636        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    637         mr_asprintf(&iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
    638         mr_asprintf(&tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
     637        mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
     638        mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
    639639        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    640640        mr_free(tmp);
     
    642642
    643643        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
    644         mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir);
     644        mr_asprintf(iso_tmp, "%s", bkpinfo->isodir);
    645645        if (strlen(iso_tmp) < strlen(iso_mnt)) {
    646             mr_asprintf(&iso_path, "%s", "");
     646            mr_asprintf(iso_path, "%s", "");
    647647        } else {
    648             mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt));
     648            mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt));
    649649        }
    650650        mr_free(iso_tmp);
    651651
    652         mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir);
     652        mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir);
    653653        write_one_liner_data_file(tmp, iso_path);
    654654        mr_free(tmp);
     
    657657        mr_free(iso_path);
    658658
    659         mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     659        mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    660660        write_one_liner_data_file(tmp, bkpinfo->prefix);
    661661        mr_free(tmp);
     
    682682                retval++;
    683683            } else {
    684                 mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
     684                mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    685685                mr_strcat(ip_address, strchr(bkpinfo->nfs_mount, ':'));
    686686                strcpy(bkpinfo->nfs_mount, ip_address);
     
    696696    }
    697697    if (bkpinfo->include_paths == NULL) {
    698         mr_asprintf(&p, "/");
     698        mr_asprintf(p, "/");
    699699        bkpinfo->include_paths = p;
    700700    }
     
    732732
    733733    unlink(MONDO_TRACEFILE);
    734     mr_asprintf(&tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
     734    mr_asprintf(tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
    735735    run_program_and_log_output(tmp, FALSE);
    736736    paranoid_free(tmp);
     
    758758        /* purging a potential old tmpdir */
    759759        log_it("Purging old tmpdir %s", bkpinfo->tmpdir);
    760         mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir);
     760        mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir);
    761761        mr_free(bkpinfo->tmpdir);
    762762        (void)system(tmp);
     
    765765
    766766    if (path != NULL) {
    767         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     767        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", path);
    768768    } else if (getenv("TMPDIR")) {
    769         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
     769        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
    770770    } else if (getenv("TMP")) {
    771         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP"));
     771        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMP"));
    772772    } else {
    773         mr_asprintf(&tmp, "/tmp/mondo.tmp.XXXXXX");
     773        mr_asprintf(tmp, "/tmp/mondo.tmp.XXXXXX");
    774774    }
    775775    p = mkdtemp(tmp);
     
    821821    bkpinfo->use_lzo = FALSE;
    822822    bkpinfo->use_gzip = FALSE;
    823     bkpinfo->do_not_compress_these[0] = '\0';
    824823    bkpinfo->verify_data = FALSE;
    825824    bkpinfo->backup_data = FALSE;
     
    829828    bkpinfo->disaster_recovery = (am_I_in_disaster_recovery_mode()? TRUE : FALSE);
    830829    if (bkpinfo->disaster_recovery) {
    831         strcpy(bkpinfo->isodir, "/");
     830        mr_asprintf(p, "%s", "/");
    832831    } else {
    833         strcpy(bkpinfo->isodir, MONDO_CACHE);
    834     }
    835     mr_asprintf(&p, "%s", STD_PREFIX);
     832        mr_asprintf(p, "%s", MONDO_CACHE);
     833    }
     834    bkpinfo->isodir = p;
     835    mr_asprintf(p, "%s", STD_PREFIX);
    836836    bkpinfo->prefix = p;
    837837    bkpinfo->scratchdir = NULL;
     
    882882    assert_string_is_neither_NULL_nor_zerolength(partition);
    883883
    884     mr_asprintf(&command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
     884    mr_asprintf(command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
    885885    if (system(command)) {
    886886        mr_free(command);
     
    889889    mr_free(command);
    890890
    891     mr_asprintf(&command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
     891    mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    892892            partition);
    893     mr_asprintf(&out_sz, "%s", call_program_and_get_last_line_of_output(command));
     893    mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command));
    894894    mr_free(command);
    895895
     
    935935            ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    936936    }
    937     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     937    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
    938938    if (atol(tmp) < 35000) {
    939939        retval++;
     
    10061006    run_program_and_log_output
    10071007        ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    1008     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
     1008    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("mount | grep -E \"cdr(om|w)\""));
    10091009    if (strcmp("", tmp)) {
    10101010        if (strstr(tmp, "autofs")) {
     
    10391039        fatal_error("Please reinstall Mondo and Mindi.");
    10401040    }
    1041     mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
     1041    mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
    10421042    if (run_program_and_log_output(tmp, 5)) {
    10431043        mr_free(tmp);
    1044         mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
     1044        mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
    10451045        log_to_screen(tmp);
    10461046        log_to_screen
     
    10871087    assert_string_is_neither_NULL_nor_zerolength(label);
    10881088    if (!does_file_exist(config_file)) {
    1089         mr_asprintf(&tmp, "(read_cfg_var) Cannot find %s config file", config_file);
     1089        mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file", config_file);
    10901090        log_to_screen(tmp);
    10911091        mr_free(tmp);
     
    10971097        return (0);
    10981098    } else {
    1099         mr_asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
     1099        mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5", label, config_file);
    11001100        strcpy(value, call_program_and_get_last_line_of_output(command));
    11011101        mr_free(command);
     
    11801180        log_msg(3, "%s --- autofs detected", g_autofs_exe);
    11811181        // FIXME -- only disable it if it's running ---  sprintf(tmp, "%s status", autofs_exe);
    1182         mr_asprintf(&tmp, "%s stop", g_autofs_exe);
     1182        mr_asprintf(tmp, "%s stop", g_autofs_exe);
    11831183        if (run_program_and_log_output(tmp, 2)) {
    11841184            log_it("Failed to stop autofs - I assume it wasn't running");
     
    12021202        return;
    12031203    }
    1204     mr_asprintf(&tmp, "%s start", g_autofs_exe);
     1204    mr_asprintf(tmp, "%s start", g_autofs_exe);
    12051205    if (run_program_and_log_output(tmp, 2)) {
    12061206        log_it("Failed to start autofs");
     
    12251225    g_boot_mountpt[0] = '\0';
    12261226    log_msg(4, "Done. Great. Seeting command to something");
    1227     mr_asprintf(&command, "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[    ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
     1227    mr_asprintf(command, "%s", "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[   ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    12281228    log_msg(4, "Cool. Command = '%s'", command);
    1229     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1229    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12301230    mr_free(command);
    12311231
     
    12331233    if (tmp[0]) {
    12341234        log_it("/boot is at %s according to /etc/fstab", tmp);
    1235         mr_asprintf(&command, "mount | grep -Ew '/boot'");
     1235        mr_asprintf(command, "mount | grep -Ew '/boot'");
    12361236        mr_free(tmp);
    1237         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1237        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12381238        mr_free(command);
    12391239
     
    12471247                }
    12481248            } else {
    1249                 mr_asprintf(&command, "mount | grep -E '^%s'", tmp);
     1249                mr_asprintf(command, "mount | grep -E '^%s'", tmp);
    12501250                log_msg(3, "command = %s", command);
    12511251                if (run_program_and_log_output(command, 5)) {
    12521252                    strcpy(g_boot_mountpt, tmp);
    12531253                    mr_free(tmp);
    1254                     mr_asprintf(&tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
     1254                    mr_asprintf(tmp, "%s (your /boot partition) is not mounted. I'll mount it before backing up", g_boot_mountpt);
    12551255                    log_it(tmp);
    12561256                    mr_free(tmp);
    12571257
    1258                     mr_asprintf(&tmp, "mount %s", g_boot_mountpt);
     1258                    mr_asprintf(tmp, "mount %s", g_boot_mountpt);
    12591259                    if (run_program_and_log_output(tmp, 5)) {
    12601260                        g_boot_mountpt[0] = '\0';
     
    12871287    log_msg(3, "starting");
    12881288    if (g_boot_mountpt[0]) {
    1289         mr_asprintf(&tmp, "umount %s", g_boot_mountpt);
     1289        mr_asprintf(tmp, "umount %s", g_boot_mountpt);
    12901290        if (run_program_and_log_output(tmp, 5)) {
    12911291            log_it("WARNING - unable to unmount /boot");
     
    13191319    assert(value != NULL);
    13201320    if (!does_file_exist(config_file)) {
    1321         mr_asprintf(&tmp, "(write_cfg_file) Cannot find %s config file", config_file);
     1321        mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file", config_file);
    13221322        log_to_screen(tmp);
    13231323        mr_free(tmp);
    13241324        return (1);
    13251325    }
    1326     mr_asprintf(&tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
     1326    mr_asprintf(tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
    13271327    if (does_file_exist(config_file)) {
    1328         mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);
     1328        mr_asprintf(command, "grep -vE '^%s .*$' %s > %s", label, config_file, tempfile);
    13291329        paranoid_system(command);
    13301330        mr_free(command);
    13311331    }
    1332     mr_asprintf(&command, "echo \"%s %s\" >> %s", label, value, tempfile);
     1332    mr_asprintf(command, "echo \"%s %s\" >> %s", label, value, tempfile);
    13331333    paranoid_system(command);
    13341334    mr_free(command);
    13351335
    1336     mr_asprintf(&command, "mv -f %s %s", tempfile, config_file);
     1336    mr_asprintf(command, "mv -f %s %s", tempfile, config_file);
    13371337    paranoid_system(command);
    13381338    mr_free(command);
     
    14631463
    14641464    if (g_magicdev_command && g_magicdev_command[0]) {
    1465         mr_asprintf(&tmp, "%s &", g_magicdev_command);
     1465        mr_asprintf(tmp, "%s &", g_magicdev_command);
    14661466        paranoid_system(tmp);
    14671467        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/libmondo-verify.c

    r2321 r2323  
    9393    assert_string_is_neither_NULL_nor_zerolength(stderr_fname);
    9494
    95     mr_asprintf(&afio_found_changes, "%s.afio", ignorefiles_fname);
     95    mr_asprintf(afio_found_changes, "%s.afio", ignorefiles_fname);
    9696    paranoid_system("sync");
    9797
    9898    log_msg(1, "Now scanning log file for 'afio: ' stuff");
    99     mr_asprintf(&command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
     99    mr_asprintf(command, "grep \"afio: \" %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
    100100    log_msg(2, command);
    101101    res = system(command);
     
    107107
    108108    log_msg(1, "Now scanning log file for 'star: ' stuff");
    109     mr_asprintf(&command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
     109    mr_asprintf(command, "grep \"star: \" %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s", stderr_fname, afio_found_changes);
    110110    log_msg(2, command);
    111111    res = system(command);
     
    116116    }
    117117    afio_diffs = count_lines_in_file(afio_found_changes);
    118     mr_asprintf(&command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname);
     118    mr_asprintf(command, "sort %s %s %s | uniq -c | awk '{ if ($1==\"2\") {print $2;};}' | grep -v \"incheckentry xwait()\" > %s", ignorefiles_fname, afio_found_changes, afio_found_changes, changedfiles_fname);
    119119    mr_free(afio_found_changes);
    120120    log_msg(2, command);
     
    167167        } else {
    168168            retval++;
    169             mr_asprintf(&tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
     169            mr_asprintf(tmp, "Warning - missing set(s) between %d and %d\n", g_last_afioball_number, set_number - 1);
    170170            log_to_screen(tmp);
    171171            mr_free(tmp);
     
    173173    }
    174174    mds = media_descriptor_string(bkpinfo->backup_media_type);
    175     mr_asprintf(&tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
     175    mr_asprintf(tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
    176176    mr_free(mds);
    177177
     
    269269    log_it("before vsbf");
    270270    mds = media_descriptor_string(bkpinfo->backup_media_type);
    271     mr_asprintf(&tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
     271    mr_asprintf(tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
    272272    mr_free(mds);
    273273
     
    276276
    277277    log_it("after vsbf");
    278     mr_asprintf(&mountpoint, "%s/archives", mtpt);
     278    mr_asprintf(mountpoint, "%s/archives", mtpt);
    279279    if (last_bigfile_num == -1) {
    280280        bigfile_num = 0;
     
    302302                paranoid_fclose(fin);
    303303            }
    304             mr_asprintf(&tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
     304            mr_asprintf(tmp, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
    305305            log_msg(2, "Opening biggiefile #%ld - '%s'", bigfile_num, tmp);
    306306            forig = fopen(tmp, "r");
     
    312312                            bkpinfo->restore_path,
    313313                            biggiestruct.filename);
    314                 mr_asprintf(&tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir);
     314                mr_asprintf(tmp, "echo \"%s/%s not found\" >> %s/biggies.changed", bkpinfo->restore_path, biggiestruct.filename, bkpinfo->tmpdir);
    315315                system(tmp);
    316316                mr_free(tmp);
     
    333333                    g_current_media_number, bigfile_num, slice_num);
    334334            if (!does_file_exist(slice_fname(bigfile_num, slice_num, mountpoint, ""))) {
    335                 mr_asprintf(&command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE);
     335                mr_asprintf(command, "%s -dc %s 2>> %s", sz_exe, slice_fname(bigfile_num, slice_num, mountpoint, bkpinfo->zip_suffix), MONDO_LOGFILE);
    336336            } else {
    337                 mr_asprintf(&command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE);
     337                mr_asprintf(command, "cat %s 2>> %s", slice_fname(bigfile_num, slice_num, mountpoint, ""), MONDO_LOGFILE);
    338338            }
    339339            pin = popen(command, "r");
     
    432432
    433433    log_it("Verifying fileset '%s'", tarball_fname);
    434     mr_asprintf(&outlog, "%s/afio.log", bkpinfo->tmpdir);
     434    mr_asprintf(outlog, "%s/afio.log", bkpinfo->tmpdir);
    435435    /* if programmer forgot to say which compression thingy to use then find out */
    436436    if (strstr(tarball_fname, ".lzo")
     
    462462        bkpinfo->use_star = TRUE;
    463463        if (strstr(tarball_fname, ".bz2"))
    464             mr_asprintf(&command, "star -diff diffopts=mode,size,data file=%s -bz >> %s 2>> %s", tarball_fname, outlog, outlog);
     464            mr_asprintf(command, "star -diff diffopts=mode,size,data file=%s %s >> %s 2>> %s", tarball_fname, (strstr(tarball_fname, ".bz2")) ? "-bz" : " ", outlog, outlog);
    465465    } else {
    466466        bkpinfo->use_star = FALSE;
    467         mr_asprintf(&command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog);
     467        mr_asprintf(command, "afio -r -P %s -Z %s >> %s 2>> %s", bkpinfo->zip_exe, tarball_fname, outlog, outlog);
    468468    }
    469469    log_msg(6, "command=%s", command);
     
    472472
    473473    if (length_of_file(outlog) < 10) {
    474         mr_asprintf(&command, "cat %s >> %s", outlog, MONDO_LOGFILE);
     474        mr_asprintf(command, "cat %s >> %s", outlog, MONDO_LOGFILE);
    475475    } else {
    476         mr_asprintf(&command, "cut -d: -f%d %s | sort -u", (bkpinfo->use_star) ? 1 : 2, outlog);
     476        mr_asprintf(command, "cut -d: -f%d %s | sort -u", (bkpinfo->use_star) ? 1 : 2, outlog);
    477477        pin = popen(command, "r");
    478478        if (pin) {
     
    580580        p++;
    581581    }
    582     mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
     582    mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
    583583    paranoid_system(tmp);
    584584    mr_free(tmp);
    585585
    586     mr_asprintf(&tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p);
     586    mr_asprintf(tarball_fname, "%s/tmpfs/temporary-%s", bkpinfo->tmpdir, p);
    587587    read_file_from_stream_to_file(tarball_fname, size);
    588588    res = verify_a_tarball(tarball_fname);
     
    639639        p++;
    640640    }
    641     mr_asprintf(&test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);
     641    mr_asprintf(test_file, "%s/temporary-%s", bkpinfo->tmpdir, p);
    642642    for (res =
    643643         read_header_block_from_stream(&slice_siz, slice_fnam, &ctrl_chr);
     
    666666        if (strcmp(biggie_cksum, orig_cksum)) {
    667667            log_msg(2, "orig cksum=%s; curr cksum=%s", biggie_cksum, orig_cksum);
    668             mr_asprintf(&tmp, "%s has changed on live filesystem", biggie_fname);
     668            mr_asprintf(tmp, "%s has changed on live filesystem", biggie_fname);
    669669            log_to_screen(tmp);
    670670            mr_free(tmp);
    671671
    672             mr_asprintf(&tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir);
     672            mr_asprintf(tmp, "echo \"%s\" >> %s/biggies.changed", biggie_fname, bkpinfo->tmpdir);
    673673            system(tmp);
    674674            mr_free(tmp);
     
    713713
    714714    if (g_getfattr) {
    715         mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     715        mr_asprintf(curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    716716    }
    717717    if (g_getfacl) {
    718         mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     718        mr_asprintf(curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    719719    }
    720720    log_to_screen("Verifying regular archives on tape");
     
    749749         res = read_header_block_from_stream(&size, fname, &ctrl_chr)) {
    750750        if (g_getfattr) {
    751             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
     751            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
    752752        }
    753753        if (g_getfacl) {
    754             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
     754            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, current_afioball_number);
    755755        }
    756756        if (ctrl_chr == BLK_START_EXTENDED_ATTRIBUTES) {
     
    770770            wrong_marker(BLK_START_AN_AFIO_OR_SLICE, ctrl_chr);
    771771        }
    772         mr_asprintf(&tmp, "Verifying fileset #%ld", current_afioball_number);
     772        mr_asprintf(tmp, "Verifying fileset #%ld", current_afioball_number);
    773773        update_progress_form(tmp);
    774774        mr_free(tmp);
     
    776776        res = verify_an_afioball_from_stream(fname, size);
    777777        if (res) {
    778             mr_asprintf(&tmp, "Afioball %ld differs from live filesystem", current_afioball_number);
     778            mr_asprintf(tmp, "Afioball %ld differs from live filesystem", current_afioball_number);
    779779            log_to_screen(tmp);
    780780            mr_free(tmp);
     
    830830
    831831    if (g_getfattr) {
    832         mr_asprintf(&curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     832        mr_asprintf(curr_xattr_list_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    833833    }
    834834    if (g_getfacl) {
    835         mr_asprintf(&curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    836     }
    837     mr_asprintf(&comment, "Verifying all bigfiles.");
     835        mr_asprintf(curr_acl_list_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     836    }
     837    mr_asprintf(comment, "Verifying all bigfiles.");
    838838    log_to_screen(comment);
    839839    res = read_header_block_from_stream(&size, orig_fname, &ctrl_chr);
     
    878878            p++;
    879879        }
    880         mr_asprintf(&comment, "Verifying bigfile #%ld (%ld K)", current_biggiefile_number, (long) size >> 10);
     880        mr_asprintf(comment, "Verifying bigfile #%ld (%ld K)", current_biggiefile_number, (long) size >> 10);
    881881        update_progress_form(comment);
    882882        mr_free(comment);
    883883
    884         mr_asprintf(&logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);
     884        mr_asprintf(logical_fname, "%s/%s", bkpinfo->restore_path, orig_fname);
    885885        res = verify_a_biggiefile_from_stream(logical_fname, size);
    886886        mr_free(logical_fname);
     
    901901 * Verify the USB device
    902902 * @param bkpinfo The backup information structure. Fields used:
    903  * - @c bkpinfo->isodir
    904903 * - @c bkpinfo->media_device
    905904 * - @c bkpinfo->tmpdir
     
    931930    assert(bkpinfo != NULL);
    932931
    933     mr_asprintf(&fname, "%s1", bkpinfo->media_device);
     932    mr_asprintf(fname, "%s1", bkpinfo->media_device);
    934933    if (is_this_device_mounted(fname)) {
    935934        log_msg(1, "USB device mounted. Remounting it at the right place");
    936         mr_asprintf(&tmp, "umount %s", fname);
     935        mr_asprintf(tmp, "umount %s", fname);
    937936        run_program_and_log_output(tmp, FALSE);
    938937        paranoid_free(tmp);
     
    941940
    942941    log_msg(1, "Mounting USB device.");
    943     mr_asprintf(&mountpoint, "%s/usb", bkpinfo->tmpdir);
    944     mr_asprintf(&tmp, "mkdir -p %s", mountpoint);
     942    mr_asprintf(mountpoint, "%s/usb", bkpinfo->tmpdir);
     943    mr_asprintf(tmp, "mkdir -p %s", mountpoint);
    945944    run_program_and_log_output(tmp, FALSE);
    946945    paranoid_free(tmp);
    947946    /* Mindi always create one single parition on the USB dev */
    948     mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);
     947    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);
    949948    ret = run_program_and_log_output(tmp, FALSE);
    950949    paranoid_free(tmp);
     
    956955    sync();
    957956    log_msg(2, "OK, I've mounted the USB Disk/Key\n");
    958     mr_asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint);
     957    mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint);
    959958    if (!does_file_exist(tmp)) {
    960959        log_msg
     
    973972    verify_all_slices_on_CD(mountpoint);
    974973
    975     mr_asprintf(&tmp1, "umount %s", mountpoint);
     974    mr_asprintf(tmp1, "umount %s", mountpoint);
    976975#ifdef __FreeBSD__
    977976    ret += system(tmp1);
     
    982981#endif
    983982    {
    984         mr_asprintf(&tmp, "%s failed; unable to unmount USB device\n", tmp1);
     983        mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1);
    985984        log_to_screen(tmp);
    986985        paranoid_free(tmp);
     
    10311030    assert(bkpinfo != NULL);
    10321031
    1033     mr_asprintf(&mountpoint, "%s/cdrom", bkpinfo->tmpdir);
    1034     mr_asprintf(&fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     1032    mr_asprintf(mountpoint, "%s/cdrom", bkpinfo->tmpdir);
     1033    mr_asprintf(fname, "%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    10351034
    10361035    mkdir(mountpoint, 1777);
     
    10541053        mddevice = make_vn(fname);
    10551054        if (ret) {
    1056             mr_asprintf(&tmp, "make_vn of %s failed; unable to verify ISO\n", fname);
     1055            mr_asprintf(tmp, "make_vn of %s failed; unable to verify ISO\n", fname);
    10571056            log_to_screen(tmp);
    10581057            mr_free(tmp);
     
    10611060            return (1);
    10621061        }
    1063         mr_asprintf(&command, "mount_cd9660 %s %s", mddevice, mountpoint);
     1062        mr_asprintf(command, "mount_cd9660 %s %s", mddevice, mountpoint);
    10641063#else
    1065         mr_asprintf(&command, "mount -o loop,ro -t iso9660 %s %s", fname, mountpoint);
     1064        mr_asprintf(command, "mount -o loop,ro -t iso9660 %s %s", fname, mountpoint);
    10661065#endif
    10671066        if (run_program_and_log_output(command, FALSE)) {
    1068             mr_asprintf(&tmp, "%s failed; unable to mount ISO image\n", command);
     1067            mr_asprintf(tmp, "%s failed; unable to mount ISO image\n", command);
    10691068            log_to_screen(tmp);
    10701069            mr_free(tmp);
     
    10771076    }
    10781077    log_msg(2, "OK, I've mounted the ISO/CD\n");
    1079     mr_asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint);
     1078    mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint);
    10801079    if (!does_file_exist(tmp)) {
    10811080        log_msg
     
    10971096#ifdef __FreeBSD__
    10981097    ret = 0;
    1099     mr_asprintf(&command, "umount %s", mountpoint);
     1098    mr_asprintf(command, "umount %s", mountpoint);
    11001099    ret += system(command);
    11011100    ret += kick_vn(mddevice);
    11021101    if (ret)
    11031102#else
    1104     mr_asprintf(&command, "umount %s", mountpoint);
     1103    mr_asprintf(command, "umount %s", mountpoint);
    11051104    if (system(command))
    11061105#endif
    11071106    {
    1108         mr_asprintf(&tmp, "%s failed; unable to unmount ISO image\n", command);
     1107        mr_asprintf(tmp, "%s failed; unable to unmount ISO image\n", command);
    11091108        log_to_screen(tmp);
    11101109        mr_free(tmp);
     
    11181117
    11191118    if (!does_file_exist(fname)) {
    1120         mr_asprintf(&command, "umount %s", bkpinfo->media_device);
     1119        mr_asprintf(command, "umount %s", bkpinfo->media_device);
    11211120        run_program_and_log_output(command, 2);
    11221121        mr_free(command);
     
    11651164/* close tape; exit */
    11661165//  fclose(g_tape_stream); <-- not needed; is handled by closein_tape()
    1167     mr_asprintf(&tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     1166    mr_asprintf(tmp, "rm -f %s/biggies.changed %s/changed.files 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
    11681167    paranoid_system(tmp);
    11691168    mr_free(tmp);
    11701169
    1171     mr_asprintf(&changed_files_fname, "%s/changed.files", bkpinfo->tmpdir);
    1172     mr_asprintf(&tmp, "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$'  > %s", (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE, changed_files_fname);
     1170    mr_asprintf(changed_files_fname, "%s/changed.files", bkpinfo->tmpdir);
     1171    mr_asprintf(tmp, "grep -E '^%s:.*$' %s | cut -d'\"' -f2 | sort -u | awk '{print \"/\"$0;};' | tr -s '/' '/' | grep -v \"(total of\" | grep -v \"incheckentry.*xwait\" | grep -vE '^/afio:.*$' | grep -vE '^dev/.*$'  > %s", (bkpinfo->use_star) ? "star" : "afio", MONDO_LOGFILE, changed_files_fname);
    11731172    log_msg(2, "Running command to derive list of changed files");
    11741173    log_msg(2, tmp);
     
    11821181    mr_free(tmp);
    11831182
    1184     mr_asprintf(&tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname);
     1183    mr_asprintf(tmp, "cat %s/biggies.changed >> %s", bkpinfo->tmpdir, changed_files_fname);
    11851184    paranoid_system(tmp);
    11861185    mr_free(tmp);
     
    11881187    diffs = count_lines_in_file(changed_files_fname);
    11891188    if (diffs > 0) {
    1190         mr_asprintf(&tmp, "cp -f %s %s/changed.files", changed_files_fname, MONDO_CACHE);
     1189        mr_asprintf(tmp, "cp -f %s %s/changed.files", changed_files_fname, MONDO_CACHE);
    11911190        run_program_and_log_output(tmp, FALSE);
    11921191        mr_free(tmp);
  • branches/2.2.10/mondo/src/common/mondostructures.h

    r2322 r2323  
    421421
    422422  /**
    423    * A filename containing a list of extensions, one per line, to not
    424    * compress. If this is set to "", afio will still exclude a set of well-known
    425    * compressed files from compression, but biggiefiles that are compressed
    426    * will be recompressed again.
    427    */
    428     char do_not_compress_these[MAX_STR_LEN / 2];
    429 
    430   /**
    431423   * If TRUE, then we should verify a backup.
    432424   */
     
    465457   * If backup_media_type is anything else, this is ignored.
    466458   */
    467     char isodir[MAX_STR_LEN / 4];
     459    char *isodir;
    468460
    469461/**
  • branches/2.2.10/mondo/src/common/newt-specific.c

    r2321 r2323  
    276276char *tmp1 = NULL;
    277277
    278     mr_asprintf(&tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);
     278    mr_asprintf(tmp,"ps %s | grep \" %s \" | awk '{print %s;}' | grep -v \"grep\"", ps_options, str , ps_proc_id);
    279279    run_program_and_log_output(tmp, TRUE);
    280280    if (strlen(tmp) > 0) {
    281         mr_asprintf(&tmp1,"kill `%s`", tmp);
     281        mr_asprintf(tmp1,"kill `%s`", tmp);
    282282        run_program_and_log_output(tmp1, TRUE);
    283283        mr_free(tmp1);
     
    334334        chdir("/");
    335335        if (g_selfmounted_isodir) {
    336             mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
     336            mr_asprintf(command, "umount %s", g_selfmounted_isodir);
    337337            run_program_and_log_output(command, 5);
    338338            mr_free(command);
    339             mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     339            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    340340            run_program_and_log_output(command, 5);
    341341            mr_free(command);
     
    386386        run_program_and_log_output("umount " MNT_CDROM, FALSE);
    387387        if (g_selfmounted_isodir) {
    388             mr_asprintf(&command, "umount %s", g_selfmounted_isodir);
     388            mr_asprintf(command, "umount %s", g_selfmounted_isodir);
    389389            run_program_and_log_output(command, 1);
    390390            mr_free(command);
    391391
    392             mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     392            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    393393            run_program_and_log_output(command, 1);
    394394            mr_free(command);
     
    409409            if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
    410410                log_msg(8,"erasing tempdir");
    411                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
     411                mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir);
    412412                system(command);
    413413                mr_free(command);
     
    418418            if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) {
    419419                log_msg(8,"erasing scratchdir");
    420                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
     420                mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir);
    421421                system(command);
    422422                mr_free(command);
     
    754754                /* take default if ENTER was typed */
    755755                mr_free(output);
    756                 mr_asprintf(&output, "%s", input);
     756                mr_asprintf(output, "%s", input);
    757757            }
    758758            if (output[strlen(output) - 1] == '\n')
     
    761761        }
    762762
    763         mr_asprintf(&blurb, "%s", b);
     763        mr_asprintf(blurb, "%s", b);
    764764        text = newtTextboxReflowed(2, 1, blurb, 48, 5, 5, 0);
    765765        type_here =
     
    782782
    783783        if (b_res == b_1) {
    784             mr_asprintf(&output, "%s", newtEntryGetValue(type_here));
     784            mr_asprintf(output, "%s", newtEntryGetValue(type_here));
    785785        }
    786786        newtPopHelpLine();
     
    982982            || percentage > g_isoform_old_progress) {
    983983            g_isoform_old_progress = percentage;
    984             mr_asprintf(&timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     984            mr_asprintf(timeline_str, "%2ld:%02ld taken            %2ld:%02ld remaining", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
    985985            if (percentage < 3) {
    986                 mr_asprintf(&pcline_str, " Working");
     986                mr_asprintf(pcline_str, " Working");
    987987                for (j = 0; j < g_mysterious_dot_counter; j++) {
    988988                    mr_strcat(pcline_str, ".");
     
    993993                mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter));
    994994            } else {
    995                 mr_asprintf(&pcline_str, " %3d%% done              %3d%% to go", percentage, 100 - percentage);
     995                mr_asprintf(pcline_str, " %3d%% done              %3d%% to go", percentage, 100 - percentage);
    996996            }
    997997            if (g_text_mode) {
    998                 mr_asprintf(&taskprogress, "TASK:  [");
     998                mr_asprintf(taskprogress, "TASK:  [");
    999999                for (i = 0; i < percentage; i += 5) {
    10001000                    mr_strcat(taskprogress, "*");
     
    11171117            printf("---progress-form---3--- %s\n", blurb3);
    11181118            printf("---progress-form---E---\n");
    1119             mr_asprintf(&taskprogress, "TASK:  [");
     1119            mr_asprintf(taskprogress, "TASK:  [");
    11201120            for (i = 0; i < percentage; i += 5) {
    11211121                mr_strcat(taskprogress, "*");
     
    11311131            paranoid_free(taskprogress);
    11321132        } else {
    1133             mr_asprintf(&timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
    1134             mr_asprintf(&percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
     1133            mr_asprintf(timeline_str, "%2ld:%02ld taken               %2ld:%02ld remaining  ", (long) time_taken / 60, (long) time_taken % 60, (long) time_remaining / 60, (long) time_remaining % 60);
     1134            mr_asprintf(percentline_str, " %3d%% done                 %3d%% to go", percentage, 100 - percentage);
    11351135
    11361136            center_string(blurb1, 54);
     
    13591359        }
    13601360
    1361         mr_asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
     1361        mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
    13621362        if (!(fout = fopen(tmp1, "a"))) {
    13631363            log_msg(2, "Can't write to %s", tmp1);
     
    14531453        assert(flentry != NULL);
    14541454        if (flentry->severity == 0) {
    1455             mr_asprintf(&tmp, "0   ");
     1455            mr_asprintf(tmp, "0   ");
    14561456        } else if (flentry->severity == 1) {
    1457             mr_asprintf(&tmp, "low ");
     1457            mr_asprintf(tmp, "low ");
    14581458        } else if (flentry->severity == 2) {
    1459             mr_asprintf(&tmp, "med ");
    1460         } else {
    1461             mr_asprintf(&tmp, "high");
     1459            mr_asprintf(tmp, "med ");
     1460        } else {
     1461            mr_asprintf(tmp, "high");
    14621462        }
    14631463        mr_strcat(tmp, "  ");
     
    15401540                                   keylist[i]);
    15411541        }
    1542         mr_asprintf(&differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
     1542        mr_asprintf(differ_sz, "  %ld files differ. Hit 'Select' to pick a file. Hit 'Close' to quit the list.", i);
    15431543        newtPushHelpLine(differ_sz);
    15441544        mr_free(differ_sz);
     
    15461546        bClose = newtCompactButton(10, 15, " Close  ");
    15471547        bSelect = newtCompactButton(30, 15, " Select ");
    1548         mr_asprintf(&tmp, "%-10s               %-20s", "Priority", "Filename");
     1548        mr_asprintf(tmp, "%-10s               %-20s", "Priority", "Filename");
    15491549        headerMsg = newtLabel(2, 1, tmp);
    15501550        mr_free(tmp);
     
    15711571                    if (filelist->entries > 0) {
    15721572                        severity_of_difference(filelist->el[currline].  filename, reason);
    1573                         mr_asprintf(&tmp, "%s --- %s", filelist->el[currline].filename, reason);
     1573                        mr_asprintf(tmp, "%s --- %s", filelist->el[currline].filename, reason);
    15741574
    15751575                        popup_and_OK(tmp);
  • branches/2.2.10/mondo/src/include/mr_mem.h

    r2320 r2323  
    1919#define mr_free(x) mr_free_int((void **)&x,__LINE__,__FILE__)
    2020#define mr_allocstr(x,y) mr_allocstr_int(x,y,__LINE__,__FILE__)
    21 #define mr_asprintf(x,y,args...) mr_asprintf_int(x,__LINE__,__FILE__,y,## args)
     21#define mr_asprintf(x,y,args...) mr_asprintf_int((char **)&x,__LINE__,__FILE__,y,## args)
    2222#define mr_getline(x,y) mr_getline_int(x,y,__LINE__,__FILE__)
    2323#define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
  • branches/2.2.10/mondo/src/lib/mr_conf.c

    r2291 r2323  
    108108    CONF = fopen(filename, "r");
    109109
    110     mr_asprintf(&mr_conf_filename, "%s", filename);
     110    mr_asprintf(mr_conf_filename, "%s", filename);
    111111
    112112    /*if file is empty or not exist => error */
     
    198198    p = mr_conf_read(field_name);
    199199    if (p != NULL) {
    200         mr_asprintf(&p1, "%d", p);
     200        mr_asprintf(p1, "%d", p);
    201201        }
    202202    return p1;
     
    210210    p = mr_conf_read(field_name);
    211211    if (p != NULL) {
    212         mr_asprintf(&p1, "%f", p);
     212        mr_asprintf(p1, "%f", p);
    213213    }
    214214    return p1;
     
    232232        return(p);
    233233    }
    234     mr_asprintf(&q, "%s", p);
     234    mr_asprintf(q, "%s", p);
    235235
    236236    if (*p != '"') {
     
    275275            (strncasecmp(p, "t" , (size_t)1) == 0) ||
    276276            (strncasecmp(p, "1" , (size_t)1) == 0)) {
    277             mr_asprintf(&p1, "%d", TRUE);
     277            mr_asprintf(p1, "%d", TRUE);
    278278        } else {
    279             mr_asprintf(&p1, "%d", FALSE);
     279            mr_asprintf(p1, "%d", FALSE);
    280280        }
    281281    }
     
    288288    char *p = NULL;
    289289
    290     mr_asprintf(&p, "%d", FALSE);
     290    mr_asprintf(p, "%d", FALSE);
    291291    if (strcmp(str,p) != 0) {
    292292        ret = TRUE;
  • branches/2.2.10/mondo/src/mondoarchive/mondoarchive.c

    r2322 r2323  
    209209
    210210    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
    211     mr_asprintf(&tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
     211    mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
    212212    setenv("PATH", tmp1, 1);
    213213    mr_free(tmp1);
    214214
    215215    /* Add the ARCH environment variable for ia64 purposes */
    216     mr_asprintf(&tmp1,"%s",get_architecture());
     216    mr_asprintf(tmp1,"%s",get_architecture());
    217217    setenv("ARCH", tmp1, 1);
    218218    mr_free(tmp1);
     
    352352        retval += res;
    353353        if (res) {
    354             mr_asprintf(&say_at_end, "Data archived. Please check the logs, just as a precaution. ");
    355         } else {
    356             mr_asprintf(&say_at_end, "Data archived OK. ");
     354            mr_asprintf(say_at_end, "Data archived. Please check the logs, just as a precaution. ");
     355        } else {
     356            mr_asprintf(say_at_end, "Data archived OK. ");
    357357        }
    358358    }
     
    362362        res = verify_data();
    363363        if (res < 0) {
    364             mr_asprintf(&tmp, "%d difference%c found.", -res,
     364            mr_asprintf(tmp, "%d difference%c found.", -res,
    365365                    (-res != 1) ? 's' : ' ');
    366             mr_asprintf(&say_at_end, "%s", tmp);
     366            mr_asprintf(say_at_end, "%s", tmp);
    367367            log_to_screen(tmp);
    368368            mr_free(tmp);
     
    402402        mr_free(say_at_end);
    403403    }
    404     mr_asprintf(&tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
     404    mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
    405405    run_program_and_log_output(tmp, TRUE);
    406406    mr_free(tmp);
    407407    if (bkpinfo->backup_media_type == usb) {
    408408        log_msg(1, "Unmounting USB device.");
    409         mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     409        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    410410        run_program_and_log_output(tmp, TRUE);
    411411        mr_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

    r2316 r2323  
    7979        make_list_of_drives_in_mountlist(mountlist, drivelist);
    8080        for (lino = 0; lino < drivelist->entries; lino++) {
    81             mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE);
     81            mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"", drivelist->el[lino].device, MONDO_WAS_HERE);
    8282            res = run_program_and_log_output(command, 1);
    8383            mr_free(command);
     
    258258        strcpy(vgremove_sz, "vgremove");
    259259    }
    260     mr_asprintf(&tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz);
     260    mr_asprintf(tmp1, "for i in `%s | cut -d\"'\" -f2 | sort -r` ; do echo \"Shutting down lv $i\" >> %s ; %s -f $i; done", lvscan_sz, MONDO_LOGFILE, lvremove_sz);
    261261    run_program_and_log_output(tmp1, 5);
    262262    mr_free(tmp1);
     
    305305            *q = '\0';
    306306            log_msg(1, "Deleting old entries at /dev/%s", tmp);
    307             mr_asprintf(&tmp1, "rm -Rf /dev/%s", tmp);
     307            mr_asprintf(tmp1, "rm -Rf /dev/%s", tmp);
    308308            run_program_and_log_output(tmp1, 1);
    309309            mr_free(tmp1);
     
    335335            log_it("%s... so I'll get creative.", tmp);
    336336            if (lvmversion == 2) {
    337                 mr_asprintf(&tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);
     337                mr_asprintf(tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);
    338338                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
    339339                mr_free(tmp1);
    340340            } else {
    341                 mr_asprintf(&tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);
     341                mr_asprintf(tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);
    342342                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
    343343                mr_free(tmp1);
     
    393393            retval++;
    394394        }
    395         mr_asprintf(&tmp1, "echo \"%s\" >> /tmp/out.sh", command);
     395        mr_asprintf(tmp1, "echo \"%s\" >> /tmp/out.sh", command);
    396396        system(tmp1);
    397397        mr_free(tmp1);
     
    484484                 fgets(incoming, MAX_STR_LEN - 1, fin));
    485485            if (!feof(fin)) {
    486                 mr_asprintf(&tmp, "Investigating %s", old_mountlist->el[lino].device);
     486                mr_asprintf(tmp, "Investigating %s", old_mountlist->el[lino].device);
    487487                log_it(tmp);
    488488                mr_free(tmp);
     
    497497                        *p = '\0';
    498498                        for (p--; p > incoming && *(p - 1) > 32; p--);
    499                         mr_asprintf(&tmp, "Extrapolating %s", p);
     499                        mr_asprintf(tmp, "Extrapolating %s", p);
    500500                        log_it(tmp);
    501501                        mr_free(tmp);
     
    518518                            new_mountlist->entries++;
    519519                        } else {
    520                             mr_asprintf(&tmp, "Not adding %s to mountlist: it's already there", p);
     520                            mr_asprintf(tmp, "Not adding %s to mountlist: it's already there", p);
    521521                            log_it(tmp);
    522522                            mr_free(tmp);
     
    582582  }
    583583  // create device list from normal disks followed by spare ones
    584   mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device);
     584  mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device);
    585585  for (j = 1; j < raidlist->el[i].data_disks.entries; j++) {
    586     mr_asprintf(&strtmp, "%s", devices);
     586    mr_asprintf(strtmp, "%s", devices);
    587587    paranoid_free(devices);
    588     mr_asprintf(&devices, "%s %s", strtmp,
     588    mr_asprintf(devices, "%s %s", strtmp,
    589589         raidlist->el[i].data_disks.el[j].device);
    590590    paranoid_free(strtmp);
    591591  }
    592592  for (j = 0; j < raidlist->el[i].spare_disks.entries; j++) {
    593     mr_asprintf(&strtmp, "%s", devices);
     593    mr_asprintf(strtmp, "%s", devices);
    594594    paranoid_free(devices);
    595     mr_asprintf(&devices, "%s %s", strtmp,
     595    mr_asprintf(devices, "%s %s", strtmp,
    596596         raidlist->el[i].spare_disks.el[j].device);
    597597    paranoid_free(strtmp);
     
    599599  // translate RAID level
    600600  if (raidlist->el[i].raid_level == -2) {
    601     mr_asprintf(&level, "multipath");
     601    mr_asprintf(level, "multipath");
    602602  } else if (raidlist->el[i].raid_level == -1) {
    603     mr_asprintf(&level, "linear");
     603    mr_asprintf(level, "linear");
    604604  } else {
    605     mr_asprintf(&level, "raid%d", raidlist->el[i].raid_level);
     605    mr_asprintf(level, "raid%d", raidlist->el[i].raid_level);
    606606  }
    607607  // create RAID device:
     
    610610  // - faulty devices ignored
    611611  // - persistent superblock always used as this is recommended
    612   mr_asprintf(&program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);
     612  mr_asprintf(program, "mdadm --create --force --run --auto=yes %s --level=%s --raid-devices=%d", raidlist->el[i].raid_device, level, raidlist->el[i].data_disks.entries);
    613613  if (raidlist->el[i].parity != -1) {
    614     mr_asprintf(&strtmp, "%s", program);
     614    mr_asprintf(strtmp, "%s", program);
    615615    paranoid_free(program);
    616616    switch(raidlist->el[i].parity) {
    617617    case 0:
    618       mr_asprintf(&program, "%s --parity=%s", strtmp, "la");
     618      mr_asprintf(program, "%s --parity=%s", strtmp, "la");
    619619      break;
    620620    case 1:
    621       mr_asprintf(&program, "%s --parity=%s", strtmp, "ra");
     621      mr_asprintf(program, "%s --parity=%s", strtmp, "ra");
    622622      break;
    623623    case 2:
    624       mr_asprintf(&program, "%s --parity=%s", strtmp, "ls");
     624      mr_asprintf(program, "%s --parity=%s", strtmp, "ls");
    625625      break;
    626626    case 3:
    627       mr_asprintf(&program, "%s --parity=%s", strtmp, "rs");
     627      mr_asprintf(program, "%s --parity=%s", strtmp, "rs");
    628628      break;
    629629    default:
     
    634634  }
    635635  if (raidlist->el[i].chunk_size != -1) {
    636     mr_asprintf(&strtmp, "%s", program);
     636    mr_asprintf(strtmp, "%s", program);
    637637    paranoid_free(program);
    638     mr_asprintf(&program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
     638    mr_asprintf(program, "%s --chunk=%d", strtmp, raidlist->el[i].chunk_size);
    639639    paranoid_free(strtmp);
    640640  }
    641641  if (raidlist->el[i].spare_disks.entries > 0) {
    642     mr_asprintf(&strtmp, "%s", program);
     642    mr_asprintf(strtmp, "%s", program);
    643643    paranoid_free(program);
    644     mr_asprintf(&program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);
     644    mr_asprintf(program, "%s --spare-devices=%d", strtmp, raidlist->el[i].spare_disks.entries);
    645645    paranoid_free(strtmp);
    646646  }
    647   mr_asprintf(&strtmp, "%s", program);
     647  mr_asprintf(strtmp, "%s", program);
    648648  paranoid_free(program);
    649   mr_asprintf(&program, "%s %s", strtmp, devices);
     649  mr_asprintf(program, "%s %s", strtmp, devices);
    650650  paranoid_free(strtmp);
    651651  res = run_program_and_log_output(program, 1);
     
    688688
    689689    if (strstr(format, "raid")) {   // do not form RAID disks; do it to /dev/md* instead
    690         mr_asprintf(&tmp, "Not formatting %s (it is a RAID disk)", device);
     690        mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device);
    691691        log_it(tmp);
    692692        mr_free(tmp);
     
    700700#endif
    701701    if (strlen(format) <= 2) {
    702         mr_asprintf(&tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);
     702        mr_asprintf(tmp, "%s has a really small format type ('%s') - this is probably a hexadecimal string, which would suggest the partition is an image --- I shouldn't format it", device, format);
    703703        log_it(tmp);
    704704        mr_free(tmp);
     
    706706    }
    707707    if (is_this_device_mounted(device)) {
    708         mr_asprintf(&tmp, "%s is mounted - cannot format it       ", device);
     708        mr_asprintf(tmp, "%s is mounted - cannot format it       ", device);
    709709        log_to_screen(tmp);
    710710        mr_free(tmp);
     
    736736            char line[MAX_STR_LEN];
    737737
    738             mr_asprintf(&tmp, "Initializing Vinum device %s (this may take a *long* time)", device);
     738            mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device);
    739739            log_to_screen(tmp);
    740740            mr_free(tmp);
    741741
    742742            /* format raid partition */
    743             mr_asprintf(&program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device));
     743            mr_asprintf(program, "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device));
    744744            system(program);
    745745            if (g_fprep) {
     
    753753                    *(strchr(line, '\n')) = '\0';   // get rid of the \n on the end
    754754
    755                 mr_asprintf(&tmp, "Initializing plex: %s", line);
     755                mr_asprintf(tmp, "Initializing plex: %s", line);
    756756                open_evalcall_form(tmp);
    757757                mr_free(tmp);
    758758
    759                 mr_asprintf(&tmp, "vinum init %s", line);
     759                mr_asprintf(tmp, "vinum init %s", line);
    760760                system(tmp);
    761761                mr_free(tmp);
    762762
    763763                while (1) {
    764                     mr_asprintf(&tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);
     764                    mr_asprintf(tmp, "vinum lp -r %s | grep '^S' | head -1 | tr -s ' ' | cut -d: -f2 | cut -f1 | sed 's/^ //' | sed 's/I //' | sed 's/%%//'", line);
    765765                    FILE *pin = popen(tmp, "r");
    766766                    mr_free(tmp);
     
    782782        }
    783783#else
    784         mr_asprintf(&tmp, "Initializing RAID device %s", device);
     784        mr_asprintf(tmp, "Initializing RAID device %s", device);
    785785        log_to_screen(tmp);
    786786        mr_free(tmp);
     
    798798            log_msg(1, "Creating RAID device %s via mdadm returned %d", device, res);
    799799        } else {
    800             mr_asprintf(&program, "mkraid --really-force %s", device);
     800            mr_asprintf(program, "mkraid --really-force %s", device);
    801801            res = run_program_and_log_output(program, 1);
    802802            log_msg(1, "%s returned %d", program, res);
     
    822822    }
    823823    program = which_format_command_do_i_need(format);
    824     mr_asprintf(&tmp, "%s %s", program, device);
     824    mr_asprintf(tmp, "%s %s", program, device);
    825825    if (strstr(program, "kludge")) {
    826826        mr_strcat(tmp, " /");
     
    828828    mr_free(program);
    829829
    830     mr_asprintf(&program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);
     830    mr_asprintf(program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);
    831831    mr_free(tmp);
    832832
    833     mr_asprintf(&tmp, "Formatting %s as %s", device, format);
     833    mr_asprintf(tmp, "Formatting %s as %s", device, format);
    834834    update_progress_form(tmp);
    835835    mr_free(tmp);
     
    848848        mr_free(program);
    849849#ifdef __FreeBSD__
    850         mr_asprintf(&program, "newfs_msdos -F 32 %s", device);
     850        mr_asprintf(program, "newfs_msdos -F 32 %s", device);
    851851#else
    852852#ifdef __IA64__
    853853        /* For EFI partitions take fat16
    854854         * as we want to make small ones */
    855         mr_asprintf(&program, "mkfs -t %s -F 16 %s", format, device);
     855        mr_asprintf(program, "mkfs -t %s -F 16 %s", format, device);
    856856#else
    857         mr_asprintf(&program, "mkfs -t %s -F 32 %s", format, device);
     857        mr_asprintf(program, "mkfs -t %s -F 32 %s", format, device);
    858858#endif
    859859#endif
     
    911911
    912912    assert(mountlist != NULL);
    913     mr_asprintf(&tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false");
     913    mr_asprintf(tmp, "format_everything (mountlist, interactively = %s", (interactively) ? "true" : "false");
    914914    log_it(tmp);
    915915    mr_free(tmp);
     
    939939            if (interactively) {
    940940                // ask user if we should format the current device
    941                 mr_asprintf(&tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);
     941                mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);
    942942                do_it = ask_me_yes_or_no(tmp);
    943943                mr_free(tmp);
     
    989989        me = &mountlist->el[lino];  // the current mountlist entry
    990990        if (!strcmp(me->mountpoint, "image")) {
    991             mr_asprintf(&tmp, "Not formatting %s - it's an image", me->device);
     991            mr_asprintf(tmp, "Not formatting %s - it's an image", me->device);
    992992            log_it(tmp);
    993993            mr_free(tmp);
    994994        } else if (!strcmp(me->format, "raid")) {
    995             mr_asprintf(&tmp, "Not formatting %s - it's a raid-let", me->device);
     995            mr_asprintf(tmp, "Not formatting %s - it's a raid-let", me->device);
    996996            log_it(tmp);
    997997            mr_free(tmp);
    998998            continue;
    999999        } else if (!strcmp(me->format, "lvm")) {
    1000             mr_asprintf(&tmp, "Not formatting %s - it's an LVM", me->device);
     1000            mr_asprintf(tmp, "Not formatting %s - it's an LVM", me->device);
    10011001            log_it(tmp);
    10021002            mr_free(tmp);
    10031003            continue;
    10041004        } else if (!strncmp(me->device, "/dev/md", 7)) {
    1005             mr_asprintf(&tmp, "Already formatted %s - it's a soft-RAID dev", me->device);
     1005            mr_asprintf(tmp, "Already formatted %s - it's a soft-RAID dev", me->device);
    10061006            log_it(tmp);
    10071007            mr_free(tmp);
     
    10101010                   && strncmp(me->device, "/dev/hd", 7)
    10111011                   && strncmp(me->device, "/dev/sd", 7)) {
    1012             mr_asprintf(&tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);
     1012            mr_asprintf(tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);
    10131013            log_it(tmp);
    10141014            mr_free(tmp);
     
    10171017            if (interactively) {
    10181018                // ask user if we should format the current device
    1019                 mr_asprintf(&tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);
     1019                mr_asprintf(tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);
    10201020                do_it = ask_me_yes_or_no(tmp);
    10211021                mr_free(tmp);
     
    10481048    }
    10491049
    1050     mr_asprintf(&tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");
     1050    mr_asprintf(tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");
    10511051    log_it(tmp);
    10521052    mr_free(tmp);
     
    11111111
    11121112    if (devno_we_must_allow_for >= 5) {
    1113         mr_asprintf(&tmp, "Making dummy primary 1 on %s", drivename);
     1113        mr_asprintf(tmp, "Making dummy primary 1 on %s", drivename);
    11141114        log_it(tmp);
    11151115        mr_free(tmp);
     
    11271127    }
    11281128    for (; current_devno < devno_we_must_allow_for; current_devno++) {
    1129         mr_asprintf(&tmp, "Creating dummy partition %d on %s", current_devno, drivename);
     1129        mr_asprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename);
    11301130        log_it(tmp);
    11311131        mr_free(tmp);
     
    13601360    for (c = 'a'; c <= 'z'; ++c) {
    13611361        int idx;
    1362         mr_asprintf(&subdev_str, "%s%c", drivename, c);
     1362        mr_asprintf(subdev_str, "%s%c", drivename, c);
    13631363        if ((idx = find_device_in_mountlist(mountlist, subdev_str)) < 0) {
    13641364            lp->d_partitions[c - 'a'].p_size = 0;
     
    14161416    display_disklabel(ftmp, lp);
    14171417    fclose(ftmp);
    1418     mr_asprintf(&command, "disklabel -wr %s auto", canonical_name(drivename));
     1418    mr_asprintf(command, "disklabel -wr %s auto", canonical_name(drivename));
    14191419    retval += run_program_and_log_output(command, TRUE);
    14201420    mr_free(command);
    14211421
    1422     mr_asprintf(&command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename));
     1422    mr_asprintf(command, "disklabel -R %s /tmp/disklabel", canonical_name(drivename));
    14231423    retval += run_program_and_log_output(command, TRUE);
    14241424    mr_free(command);
     
    14681468    malloc_string(format);
    14691469
    1470     mr_asprintf(&tmp, "Partitioning drive %s", drivename);
     1470    mr_asprintf(tmp, "Partitioning drive %s", drivename);
    14711471    log_it(tmp);
    14721472    mr_free(tmp);
     
    14771477#else
    14781478    make_hole_for_file(FDISK_LOG);
    1479     mr_asprintf(&tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
     1479    mr_asprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
    14801480    pout_to_fdisk = popen(tmp, "w");
    14811481    mr_free(tmp);
     
    15001500                // try DangerouslyDedicated mode
    15011501                for (c = 'a'; c <= 'z'; c++) {
    1502                     mr_asprintf(&subdev_str, "%s%c", drivename, c);
     1502                    mr_asprintf(subdev_str, "%s%c", drivename, c);
    15031503                    if (find_device_in_mountlist(mountlist, subdev_str) > 0) {
    15041504                        fbsd_part = TRUE;
     
    15101510                                                 drivename,
    15111511                                                 0);
    1512                     mr_asprintf(&command, "disklabel -B %s", basename(drivename));
     1512                    mr_asprintf(command, "disklabel -B %s", basename(drivename));
    15131513                    if (system(command)) {
    15141514                        log_to_screen
     
    15221522            }
    15231523            for (c = 'a'; c <= 'z'; c++) {
    1524                 mr_asprintf(&subdev_str, "%s%c", device_str, c);
     1524                mr_asprintf(subdev_str, "%s%c", device_str, c);
    15251525                if (find_device_in_mountlist(mountlist, subdev_str) > 0) {
    15261526                    fbsd_part = TRUE;
     
    15351535                partsize = 0;
    15361536                for (i = 'a'; i < 'z'; ++i) {
    1537                     mr_asprintf(&subdev_str, "%s%c", device_str, i);
     1537                    mr_asprintf(subdev_str, "%s%c", device_str, i);
    15381538                    line = find_device_in_mountlist(mountlist, subdev_str);
    15391539                    mr_free(subdev_str);
     
    15651565            file = open(drivename, O_WRONLY);
    15661566            if (file != -1) {
    1567                 mr_asprintf(&tmp, "Warning - unable to open %s for wiping it's partition table", drivename);
     1567                mr_asprintf(tmp, "Warning - unable to open %s for wiping it's partition table", drivename);
    15681568                log_to_screen(tmp);
    15691569                mr_free(tmp);
     
    15721572            for (i = 0; i < 512; i++) {
    15731573                if (!write(file, "\0", 1)) {
    1574                     mr_asprintf(&tmp, "Warning - unable to write to %s", drivename);
     1574                    mr_asprintf(tmp, "Warning - unable to write to %s", drivename);
    15751575                    log_to_screen(tmp);
    15761576                    mr_free(tmp);
     
    16181618#ifdef __FreeBSD__
    16191619        if ((current_devno <= 4) && fbsd_part) {
    1620             mr_asprintf(&tmp, "disklabel -B %s", basename(device_str));
     1620            mr_asprintf(tmp, "disklabel -B %s", basename(device_str));
    16211621            retval += label_drive_or_slice(mountlist, device_str, 0);
    16221622            if (system(tmp)) {
     
    16341634    if (pout_to_fdisk) {
    16351635// mark relevant partition as bootable
    1636         mr_asprintf(&tmp, "a\n%s\n", call_program_and_get_last_line_of_output("make-me-bootable /tmp/mountlist.txt dummy"));
     1636        mr_asprintf(tmp, "a\n%s\n", call_program_and_get_last_line_of_output ("make-me-bootable /tmp/mountlist.txt dummy"));
    16371637        fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    16381638        mr_free(tmp);
     
    16441644        log_msg(0,
    16451645                "------------------- fdisk.log looks like this ------------------");
    1646         mr_asprintf(&tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
     1646        mr_asprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
    16471647        system(tmp);
    16481648        mr_free(tmp);
     
    16501650        log_msg(0,
    16511651                "------------------- end of fdisk.log... word! ------------------");
    1652         mr_asprintf(&tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
     1652        mr_asprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
    16531653        if (!run_program_and_log_output(tmp, 5)) {
    16541654            g_partition_table_locked_up++;
     
    16561656        mr_free(tmp);
    16571657
    1658         mr_asprintf(&tmp, "partprobe %s", drivename);
     1658        mr_asprintf(tmp, "partprobe %s", drivename);
    16591659        if (!run_program_and_log_output(tmp, 5)) {
    16601660            g_partition_table_locked_up--;
     
    17081708
    17091709    if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    1710         mr_asprintf(&tmp, "Not partitioning %s - it is a virtual drive", drive);
     1710        mr_asprintf(tmp, "Not partitioning %s - it is a virtual drive", drive);
    17111711        log_it(tmp);
    17121712        mr_free(tmp);
     
    17161716    partition_name = build_partition_name(drive, partno);
    17171717    if (partsize <= 0) {
    1718         mr_asprintf(&tmp, "Partitioning device %s (max size)", partition_name);
     1718        mr_asprintf(tmp, "Partitioning device %s (max size)", partition_name);
    17191719    } else {
    1720         mr_asprintf(&tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024);
     1720        mr_asprintf(tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024);
    17211721    }
    17221722    update_progress_form(tmp);
     
    17251725
    17261726    if (is_this_device_mounted(partition_name)) {
    1727         mr_asprintf(&tmp, "%s is mounted, and should not be partitioned", partition_name);
     1727        mr_asprintf(tmp, "%s is mounted, and should not be partitioned", partition_name);
    17281728        log_to_screen(tmp);
    17291729        mr_free(tmp);
     
    17371737    /* BERLIOS: should not be called each time */
    17381738    part_table_fmt = which_partition_format(drive);
    1739     mr_asprintf(&output, "");
     1739    mr_asprintf(output, "");
    17401740    /* make it a primary/extended/logical */
    17411741    if (partno <= 4) {
     
    17691769    }
    17701770    mr_strcat(output, "\n");
    1771     mr_asprintf(&tmp,"PARTSIZE = +%ld",(long)partsize);
     1771    mr_asprintf(tmp,"PARTSIZE = +%ld",(long)partsize);
    17721772    log_it(tmp);
    17731773    mr_free(tmp);
     
    17771777    log_it("---end of fdisk---");
    17781778
    1779     mr_asprintf(&program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);
     1779    mr_asprintf(program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);
    17801780    if (pout_to_fdisk) {
    17811781        log_msg(1, "Doing the new all-in-one fdisk thing");
     
    17831783        fput_string_one_char_at_a_time(pout_to_fdisk, output);
    17841784        fput_string_one_char_at_a_time(pout_to_fdisk, "\n\np\n");
    1785         mr_asprintf(&tmp, "%s", last_line_of_file(FDISK_LOG));
     1785        mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG));
    17861786        if (strstr(tmp, " (m ")) {
    17871787            log_msg(1, "Successfully created partition %d on %s", partno, drive);
     
    18261826                                 format, -1);
    18271827            if (res) {
    1828                 mr_asprintf(&tmp, "Failed to vacuum-pack %s", partition_name);
     1828                mr_asprintf(tmp, "Failed to vacuum-pack %s", partition_name);
    18291829                log_it(tmp);
    18301830                mr_free(tmp);
     
    18401840                                   partsize);
    18411841            if (retval) {
    1842                 mr_asprintf(&tmp, "Partitioned %s but failed to set its type", partition_name);
     1842                mr_asprintf(tmp, "Partitioned %s but failed to set its type", partition_name);
    18431843                log_it(tmp);
    18441844                mr_free(tmp);
    18451845            } else {
    18461846                if (partsize > 0) {
    1847                     mr_asprintf(&tmp, "Partition %s created+configured OK", partition_name);
     1847                    mr_asprintf(tmp, "Partition %s created+configured OK", partition_name);
    18481848                    log_to_screen(tmp);
    18491849                    mr_free(tmp);
     
    18531853            }
    18541854        } else {
    1855             mr_asprintf(&tmp, "Failed to partition %s", partition_name);
     1855            mr_asprintf(tmp, "Failed to partition %s", partition_name);
    18561856            if (partsize > 0) {
    18571857                log_to_screen(tmp);
     
    19971997    p = (char *) strrchr(partition, '/');
    19981998    if (strcmp(format, "swap") == 0) {
    1999         mr_asprintf(&partcode, "82");
     1999        mr_asprintf(partcode, "82");
    20002000    } else if (strcmp(format, "vfat") == 0) {
    20012001        if (partsize / 1024 > 8192) {
    2002             mr_asprintf(&partcode, "c");
     2002            mr_asprintf(partcode, "c");
    20032003        } else {
    2004             mr_asprintf(&partcode, "b");
     2004            mr_asprintf(partcode, "b");
    20052005        }
    20062006    } else if (strcmp(format, "ext2") == 0
     
    20102010               || strcmp(format, "xfs") == 0
    20112011               || strcmp(format, "jfs") == 0) {
    2012         mr_asprintf(&partcode, "83");
     2012        mr_asprintf(partcode, "83");
    20132013    } else if (strcmp(format, "minix") == 0) {
    2014         mr_asprintf(&partcode, "81");
     2014        mr_asprintf(partcode, "81");
    20152015    } else if (strcmp(format, "vmfs3") == 0) {
    2016         mr_asprintf(&partcode, "fb");
     2016        mr_asprintf(partcode, "fb");
    20172017    } else if (strcmp(format, "vmkcore") == 0) {
    2018         mr_asprintf(&partcode, "fc");
     2018        mr_asprintf(partcode, "fc");
    20192019    } else if (strcmp(format, "raid") == 0) {
    2020         mr_asprintf(&partcode, "fd");
     2020        mr_asprintf(partcode, "fd");
    20212021    } else if (strcmp(format, "ntfs") == 0) {
    2022         mr_asprintf(&partcode, "7");
     2022        mr_asprintf(partcode, "7");
    20232023    } else if ((strcmp(format, "ufs") == 0)
    20242024               || (strcmp(format, "ffs") == 0)) {   /* raid autodetect */
    2025         mr_asprintf(&partcode, "a5");
     2025        mr_asprintf(partcode, "a5");
    20262026    } else if (strcmp(format, "lvm") == 0) {
    2027         mr_asprintf(&partcode, "8e");
     2027        mr_asprintf(partcode, "8e");
    20282028    } else if (format[0] == '\0') { /* LVM physical partition */
    2029         mr_asprintf(&partcode, "");
     2029        mr_asprintf(partcode, "");
    20302030    } else if (strlen(format) >= 1 && strlen(format) <= 2) {
    2031         mr_asprintf(&partcode, format);
     2031        mr_asprintf(partcode, format);
    20322032    } else {
    20332033        /* probably an image */
    2034         mr_asprintf(&tmp, "Unknown format ('%s') - using supplied string anyway", format);
     2034        mr_asprintf(tmp, "Unknown format ('%s') - using supplied string anyway", format);
    20352035        mvaddstr_and_log_it(g_currentY++, 0, tmp);
    20362036        mr_free(tmp);
    20372037#ifdef __FreeBSD__
    2038         mr_asprintf(&partcode, format); // was a5
     2038        mr_asprintf(partcode, format);  // was a5
    20392039#else
    2040         mr_asprintf(&partcode, format); // was 83
     2040        mr_asprintf(partcode, format);  // was 83
    20412041#endif
    20422042    }
     
    20522052                || strstr(last_line_of_file(FDISK_LOG), " (1-4)")) {
    20532053                log_msg(5, "Specifying partno (%d) - yay", partno);
    2054                 mr_asprintf(&tmp, "%d\n", partno);
     2054                mr_asprintf(tmp, "%d\n", partno);
    20552055                fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    20562056                mr_free(tmp);
     
    20602060            }
    20612061
    2062             mr_asprintf(&tmp, "%s\n", partcode);
     2062            mr_asprintf(tmp, "%s\n", partcode);
    20632063            fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
    20642064            mr_free(tmp);
     
    20702070                    last_line_of_file(FDISK_LOG));
    20712071
    2072             mr_asprintf(&tmp, "%s", last_line_of_file(FDISK_LOG));
     2072            mr_asprintf(tmp, "%s", last_line_of_file(FDISK_LOG));
    20732073            if (!strstr(tmp, " (m ")) {
    20742074                log_msg(1, "last line = '%s'; part type set failed", tmp);
     
    20802080            fput_string_one_char_at_a_time(pout_to_fdisk, "p\n");
    20812081        } else {
    2082             mr_asprintf(&output, "t\n%d\n%s\nw\n", partno, partcode);
    2083             mr_asprintf(&command, "parted2fdisk %s >> %s 2>> %s", drive,
     2082            mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode);
     2083            mr_asprintf(command, "parted2fdisk %s >> %s 2>> %s", drive,
    20842084                    MONDO_LOGFILE, MONDO_LOGFILE);
    20852085            log_msg(5, "output = '%s'", output);
     
    21232123        return 1;
    21242124    }
    2125     mr_asprintf(&program, "vinum start -f %s", raid_device);
     2125    mr_asprintf(program, "vinum start -f %s", raid_device);
    21262126#else
    2127     mr_asprintf(&program, "raidstart %s", raid_device);
     2127    mr_asprintf(program, "raidstart %s", raid_device);
    21282128#endif
    21292129    log_msg(1, "program = %s", program);
     
    21682168        return 1;
    21692169    }
    2170     mr_asprintf(&program, "vinum stop -f %s", raid_device);
     2170    mr_asprintf(program, "vinum stop -f %s", raid_device);
    21712171#else
    21722172    // use raidstop if it exists, otherwise use mdadm
    21732173    if (run_program_and_log_output("which raidstop", FALSE)) {
    2174         mr_asprintf(&program, "mdadm -S %s", raid_device);
     2174        mr_asprintf(program, "mdadm -S %s", raid_device);
    21752175    } else {
    2176         mr_asprintf(&program, "raidstop %s", raid_device);
     2176        mr_asprintf(program, "raidstop %s", raid_device);
    21772177    }
    21782178#endif
     
    23202320    if (strcmp(format, "swap") == 0) {
    23212321#ifdef __FreeBSD__
    2322         mr_asprintf(&program, "true");
     2322        mr_asprintf(program, "true");
    23232323#else
    2324         mr_asprintf(&program, "mkswap");
     2324        mr_asprintf(program, "mkswap");
    23252325#endif
    23262326    } else if (strcmp(format, "vfat") == 0) {
    2327         mr_asprintf(&program, "format-and-kludge-vfat");
     2327        mr_asprintf(program, "format-and-kludge-vfat");
    23282328#ifndef __FreeBSD__
    23292329    } else if (strcmp(format, "reiserfs") == 0) {
    2330         mr_asprintf(&program, "mkreiserfs -ff");
     2330        mr_asprintf(program, "mkreiserfs -ff");
    23312331    } else if (strcmp(format, "xfs") == 0) {
    2332         mr_asprintf(&program, "mkfs.xfs -f -q");
     2332        mr_asprintf(program, "mkfs.xfs -f -q");
    23332333    } else if (strcmp(format, "jfs") == 0) {
    2334         mr_asprintf(&program, "mkfs.jfs");
     2334        mr_asprintf(program, "mkfs.jfs");
    23352335    } else if (strcmp(format, "ext3") == 0) {
    2336         mr_asprintf(&program, "mkfs -t ext3 -F -q");
     2336        mr_asprintf(program, "mkfs -t ext3 -F -q");
    23372337    } else if (strcmp(format, "ext4") == 0) {
    2338         mr_asprintf(&program, "mkfs -t ext4 -F -q");
     2338        mr_asprintf(program, "mkfs -t ext4 -F -q");
    23392339    } else if (strcmp(format, "minix") == 0) {
    2340         mr_asprintf(&program, "mkfs.minix");
     2340        mr_asprintf(program, "mkfs.minix");
    23412341    } else if (strcmp(format, "vmfs") == 0) {
    2342         mr_asprintf(&program, "mkfs -t vmfs");
     2342        mr_asprintf(program, "mkfs -t vmfs");
    23432343    } else if (strcmp(format, "ntfs") == 0) {
    23442344        /*
     
    23462346         * so the default "mkfs -t %s -c" command structure fails
    23472347         */
    2348         mr_asprintf(&program, "mkfs -t ntfs");
     2348        mr_asprintf(program, "mkfs -t ntfs");
    23492349    } else if (strcmp(format, "ocfs2") == 0) {
    23502350        /*
     
    23522352         *
    23532353         */
    2354         mr_asprintf(&program, "mkfs -t ocfs2 -F");
     2354        mr_asprintf(program, "mkfs -t ocfs2 -F");
    23552355#endif
    23562356    } else if (strcmp(format, "ext2") == 0) {
    2357         mr_asprintf(&program, "mke2fs -F -q");
     2357        mr_asprintf(program, "mke2fs -F -q");
    23582358    } else {
    23592359#ifdef __FreeBSD__
    2360         mr_asprintf(&program, "newfs_%s", format);
     2360        mr_asprintf(program, "newfs_%s", format);
    23612361#else
    2362         mr_asprintf(&program, "mkfs -t %s -c", format); // -c checks for bad blocks
    2363 #endif
    2364         mr_asprintf(&tmp, "Unknown format (%s) - assuming '%s' will do", format, program);
     2362        mr_asprintf(program, "mkfs -t %s -c", format);  // -c checks for bad blocks
     2363#endif
     2364        mr_asprintf(tmp, "Unknown format (%s) - assuming '%s' will do", format, program);
    23652365        log_it(tmp);
    23662366        mr_free(tmp);
     
    24252425        return;
    24262426    }
    2427     mr_asprintf(&tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);
     2427    mr_asprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);
    24282428    log_to_screen(tmp);
    24292429    mr_free(tmp);
     
    24452445
    24462446    if (original_size_of_drive <= 0) {
    2447         mr_asprintf(&tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
     2447        mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
    24482448        log_to_screen(tmp);
    24492449        mr_free(tmp);
     
    24512451    }
    24522452    factor = (float) (current_size_of_drive) / (float) (original_size_of_drive);
    2453     mr_asprintf(&tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor);
     2453    mr_asprintf(tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f", drive_name, original_size_of_drive, current_size_of_drive, factor);
    24542454    log_to_screen(tmp);
    24552455    mr_free(tmp);
     
    24782478        }
    24792479
    2480         mr_asprintf(&tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
     2480        mr_asprintf(tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
    24812481        log_to_screen(tmp);
    24822482        mr_free(tmp);
     
    24842484    }
    24852485    final_size = get_phys_size_of_drive(drive_name);
    2486     mr_asprintf(&tmp, "final_size = %ld MB", final_size);
     2486    mr_asprintf(tmp, "final_size = %ld MB", final_size);
    24872487    log_to_screen(tmp);
    24882488    mr_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-compare.c

    r2321 r2323  
    7979            insist_on_this_cd_number((++g_current_media_number));
    8080        } else {
    81             mr_asprintf(&tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
     81            mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
    8282            log_msg(2, tmp_ptr);
    8383            paranoid_free(tmp_ptr);
     
    8686    }
    8787    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
    88         mr_asprintf(&tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
     88        mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
    8989        log_to_screen(tmp_ptr);
    9090        paranoid_free(tmp_ptr);
     
    101101
    102102    if (!g_text_mode) {
    103         mr_asprintf(&tmp_ptr, "Comparing %s", bigfile_fname_ptr);
     103        mr_asprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr);
    104104        newtDrawRootText(0, 22, tmp_ptr);
    105105        paranoid_free(tmp_ptr);
     
    120120    mr_free(command_ptr);
    121121
    122     mr_asprintf(&tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
     122    mr_asprintf(tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
    123123    paranoid_system(tmp_ptr);
    124124    paranoid_free(tmp_ptr);
     
    146146        }
    147147    }
    148     mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);
     148    mr_asprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);
    149149    if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) {
    150150        mr_strcat(tmp_ptr, " ... OK");
     
    274274
    275275    if (use_star) {
    276         mr_asprintf(&archiver_exe, "star");
    277     } else {
    278         mr_asprintf(&archiver_exe, "afio");
     276        mr_asprintf(archiver_exe, "star");
     277    } else {
     278        mr_asprintf(archiver_exe, "afio");
    279279    }
    280280
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-newt.c

    r2316 r2323  
    472472    char *prompt = NULL;
    473473
    474     mr_asprintf(&prompt, "Please enter the RAID level you want. (concat, striped, raid5)");
     474    mr_asprintf(prompt, "Please enter the RAID level you want. (concat, striped, raid5)");
    475475    if (raidrec->raidlevel == -1) {
    476         mr_asprintf(&tmp, "concat");
     476        mr_asprintf(tmp, "concat");
    477477    } else if (raidrec->raidlevel == 0) {
    478         mr_asprintf(&tmp, "striped");
     478        mr_asprintf(tmp, "striped");
    479479    } else {
    480         mr_asprintf(&tmp, "raid%i", raidrec->raidlevel);
     480        mr_asprintf(tmp, "raid%i", raidrec->raidlevel);
    481481    }
    482482    for (out = 999; out == 999;) {
     
    538538
    539539    system("grep Pers /proc/mdstat > /tmp/raid-personalities.txt 2> /dev/null");
    540     mr_asprintf(&personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt"));
    541     mr_asprintf(&prompt, "Please enter the RAID level you want. %s", personalities);
     540    mr_asprintf(personalities, "%s", last_line_of_file("/tmp/raid-personalities.txt"));
     541    mr_asprintf(prompt, "Please enter the RAID level you want. %s", personalities);
    542542    mr_free(personalities);
    543543
    544544    if (raidrec->raid_level == -1) {
    545         mr_asprintf(&tmp, "linear");
     545        mr_asprintf(tmp, "linear");
    546546    } else {
    547         mr_asprintf(&tmp, "%d", raidrec->raid_level);
     547        mr_asprintf(tmp, "%d", raidrec->raid_level);
    548548    }
    549549    for (out = 999;
     
    18501850            char *tmp = NULL;
    18511851
    1852             mr_asprintf(&tmp, "%i", raidrec->stripesize);
     1852            mr_asprintf(tmp, "%i", raidrec->stripesize);
    18531853            p = popup_and_get_string("Stripe size", "Please enter the stripe size in kilobytes.", tmp);
    18541854            mr_free(tmp);
     
    18991899    assert(lino >= 0);
    19001900
    1901     mr_asprintf(&sz_out, "%s", raidrec->additional_vars.el[lino].value);
    1902     mr_asprintf(&header, "Edit %s", raidrec->additional_vars.el[lino].label);
    1903     mr_asprintf(&comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out);
     1901    mr_asprintf(sz_out, "%s", raidrec->additional_vars.el[lino].value);
     1902    mr_asprintf(header, "Edit %s", raidrec->additional_vars.el[lino].label);
     1903    mr_asprintf(comment, "Please set %s's value (currently '%s')", raidrec->additional_vars.el[lino].label, sz_out);
    19041904    p = popup_and_get_string(header, comment, sz_out);
    19051905    if (p != NULL) {
     
    19571957    assert(raidlist != NULL);
    19581958
    1959     mr_asprintf(&flaws_str_A, "%s", "         ");
    1960     mr_asprintf(&flaws_str_B, "%s", "         ");
    1961     mr_asprintf(&flaws_str_C, "%s", "         ");
     1959    mr_asprintf(flaws_str_A, "%s", "         ");
     1960    mr_asprintf(flaws_str_B, "%s", "         ");
     1961    mr_asprintf(flaws_str_C, "%s", "         ");
    19621962    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    19631963        log_to_screen("Arbitrary limits suck, man!");
     
    22832283    log_it("isodir_path = %s", isodir_path);
    22842284    if (isodir_device[0] == '\0') {
    2285         mr_asprintf(&idev, "/dev/");
     2285        mr_asprintf(idev, "/dev/");
    22862286    } else {
    2287         mr_asprintf(&idev, "%s", isodir_device);
    2288     }
    2289 
    2290     if (isodir_path[0] == '\0') {
    2291         strcpy(isodir_path, "/");
    2292     }
     2287        mr_asprintf(idev, "%s", isodir_device);
     2288    }
     2289
    22932290    if (does_file_exist("/tmp/NFS-SERVER-PATH")) {
    22942291        mr_free(idev);
    2295         mr_asprintf(&idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT"));
    2296         mr_asprintf(&isodir_format, "nfs");
    2297         strcpy(isodir_path, last_line_of_file("/tmp/NFS-SERVER-PATH"));
     2292        mr_asprintf(idev, "%s", last_line_of_file("/tmp/NFS-SERVER-MOUNT"));
     2293        mr_asprintf(isodir_format, "nfs");
     2294        mr_free(isodir_path);
     2295        mr_asprintf(isodir_path, "%s", last_line_of_file("/tmp/NFS-SERVER-PATH"));
    22982296    }
    22992297
     
    23192317                    /* modify for the caller */
    23202318                    strcpy(isodir_device, p);
    2321                     strcpy(isodir_path, r);
     2319                    mr_free(isodir_path);
     2320                    isodir_path = r;
    23222321                    log_it("isodir_device = %s - isodir_format = %s - isodir_path = %s", isodir_device, isodir_format, isodir_path);
    2323                     mr_free(r);
    23242322   
    23252323                    ret = TRUE;
     
    27702768
    27712769    log_it("Post-malloc");
    2772     mr_asprintf(&help_text, "   Edit this RAID device's list of partitions. Choose OK or Cancel when done.");
    2773     mr_asprintf(&header_text, "%-24s    %s", "Device", "Index");
    2774     mr_asprintf(&title_of_window, "%s contains...", raidrec->raid_device);
     2770    mr_asprintf(help_text, "   Edit this RAID device's list of partitions. Choose OK or Cancel when done.");
     2771    mr_asprintf(header_text, "%-24s    %s", "Device", "Index");
     2772    mr_asprintf(title_of_window, "%s contains...", raidrec->raid_device);
    27752773    newtPushHelpLine(help_text);
    27762774    for (b_res = (newtComponent) 12345; b_res != bOK && b_res != bCancel;) {
     
    28272825                    redraw_disklist(disklist, keylist, partitionsListbox);
    28282826                } else {
    2829                     mr_asprintf(&tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index);
    2830                     mr_asprintf(&sz_res, "%d", disklist->el[currline].index);
     2827                    mr_asprintf(tmp, "%s's index is %d. What should it be?", raidrec->raid_device, disklist->el[currline].index);
     2828                    mr_asprintf(sz_res, "%d", disklist->el[currline].index);
    28312829                    p = popup_and_get_string("Set index", tmp, sz_res);
    28322830                    mr_free(tmp);
  • branches/2.2.10/mondo/src/mondorestore/mondo-rstr-tools.c

    r2322 r2323  
    144144}
    145145
    146 mr_asprintf(&question_ptr, "Should I restore the image of %s ?", incoming_ptr);
     146mr_asprintf(question_ptr, "Should I restore the image of %s ?", incoming_ptr);
    147147
    148148if (ask_me_yes_or_no(question_ptr)) {
     
    228228}
    229229log_msg(2, "Checking to see if f=%s, file=%s, is in the list of biggiefiles", f, file);
    230 mr_asprintf(&command, "grep -E '^%s$' %s", file, list_fname);
     230mr_asprintf(command, "grep -E '^%s$' %s", file, list_fname);
    231231res = run_program_and_log_output(command, FALSE);
    232232mr_free(command);
     
    260260    char *command = NULL;
    261261    char *mds = NULL;
     262    char *p = NULL;
    262263    int retval = 0, i;
    263264    bool already_mounted = FALSE;
    264265    char *isodir_format = NULL;
    265266
    266 assert(bkpinfo != NULL);
    267267g_ISO_restore_mode = TRUE;
    268268read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
     
    271271    * Don't let this clobber an existing bkpinfo->isodir */
    272272    if (!bkpinfo->isodir[0]) {
    273         strcpy(bkpinfo->isodir, "/tmp/isodir");
     273        mr_free(bkpinfo->isodir);
     274        mr_asprintf(p, "/tmp/isodir");
     275        bkpinfo->isodir = p;
    274276    }
    275277    /* End patch */
    276     mr_asprintf(&command, "mkdir -p %s", bkpinfo->isodir);
     278    mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir);
    277279    run_program_and_log_output(command, 5);
    278280    mr_free(command);
     
    290292    already_mounted = TRUE;
    291293} else {
    292     mr_asprintf(&mount_isodir_command, "mount %s", g_isodir_device);
     294    mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device);
    293295    if (isodir_format) {
    294296        mr_strcat(mount_isodir_command, " -t %s", isodir_format);
     
    320322log_msg(1, "%s #%d has been mounted via loopback mount", mds, i);
    321323if (i < 0) {
    322 popup_and_OK
    323     ("Cannot find ISO images in the directory you specified.");
    324 retval = 1;
    325 }
    326 log_msg(2, "%ld: bkpinfo->isodir is now %s", __LINE__,
    327     bkpinfo->isodir);
     324    popup_and_OK("Cannot find ISO images in the directory you specified.");
     325    retval = 1;
     326}
     327log_msg(2, "bkpinfo->isodir is now %s", bkpinfo->isodir);
    328328return (retval);
    329329}
     
    368368
    369369    if (!strcmp(mpt, "/1")) {
    370         mr_asprintf(&mountpoint, "/");
     370        mr_asprintf(mountpoint, "/");
    371371        log_msg(3, "Mommm! SME is being a dildo!");
    372372    } else {
    373         mr_asprintf(&mountpoint, "%s", mpt);
     373        mr_asprintf(mountpoint, "%s", mpt);
    374374    }
    375375
     
    380380        return (0);
    381381    }
    382     mr_asprintf(&tmp, "Mounting device %s   ", device);
     382    mr_asprintf(tmp, "Mounting device %s   ", device);
    383383    log_msg(1, tmp);
    384384    /* Deal with additional params only if not /proc or /sys */
    385     mr_asprintf(&additional_parameters, "");
     385    mr_asprintf(additional_parameters, "");
    386386    if (strcmp(format, "proc") && strcmp(format, "sys")) {
    387387        if (writeable) {
     
    399399
    400400    if (!strcmp(mountpoint, "swap")) {
    401         mr_asprintf(&command, "swapon %s", device);
    402         mr_asprintf(&mountdir, "swap");
     401        mr_asprintf(command, "swapon %s", device);
     402        mr_asprintf(mountdir, "swap");
    403403    } else {
    404404        if (!strcmp(mountpoint, "/")) {
    405             mr_asprintf(&mountdir, "%s", MNT_RESTORING);
     405            mr_asprintf(mountdir, "%s", MNT_RESTORING);
    406406        } else {
    407             mr_asprintf(&mountdir, "%s%s", MNT_RESTORING, mountpoint);
    408         }
    409         mr_asprintf(&command, "mkdir -p %s", mountdir);
     407            mr_asprintf(mountdir, "%s%s", MNT_RESTORING, mountpoint);
     408        }
     409        mr_asprintf(command, "mkdir -p %s", mountdir);
    410410        run_program_and_log_output(command, FALSE);
    411411        mr_free(command);
    412412
    413         mr_asprintf(&command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE);
     413        mr_asprintf(command, "mount -t %s %s %s %s 2>> %s", format, device, additional_parameters, mountdir, MONDO_LOGFILE);
    414414        log_msg(2, "command='%s'", command);
    415415    }
     
    420420        log_msg(1, "Re-trying without the fancy extra parameters");
    421421        mr_free(command);
    422         mr_asprintf(&command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE);
     422        mr_asprintf(command, "mount -t %s %s %s 2>> %s", format, device, mountdir, MONDO_LOGFILE);
    423423        res = run_program_and_log_output(command, TRUE);
    424424    }
     
    432432            log_msg(2, "Retrying w/o the '-t' switch");
    433433            mr_free(command);
    434             mr_asprintf(&command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE);
     434            mr_asprintf(command, "mount %s %s 2>> %s", device, mountdir, MONDO_LOGFILE);
    435435            log_msg(2, "2nd command = '%s'", command);
    436436            res = run_program_and_log_output(command, TRUE);
     
    492492               "", mountlist->entries);
    493493
    494     mr_asprintf(&these_failed, "");
     494    mr_asprintf(these_failed, "");
    495495    for (lino = 0; lino < mountlist->entries; lino++) {
    496496        if (!strcmp(mountlist->el[lino].device, "/proc")) {
     
    498498                "Again with the /proc - why is this in your mountlist?");
    499499        } else if (is_this_device_mounted(mountlist->el[lino].device)) {
    500             mr_asprintf(&tmp, "%s is already mounted", mountlist->el[lino].device);
     500            mr_asprintf(tmp, "%s is already mounted", mountlist->el[lino].device);
    501501            log_to_screen(tmp);
    502502            mr_free(tmp);
     
    505505           && strcmp(mountlist->el[lino].mountpoint, "raid")
    506506           && strcmp(mountlist->el[lino].mountpoint, "image")) {
    507             mr_asprintf(&tmp, "Mounting %s", mountlist->el[lino].device);
     507            mr_asprintf(tmp, "Mounting %s", mountlist->el[lino].device);
    508508            update_progress_form(tmp);
    509509            mr_free(tmp);
     
    529529                ("format and restore *without* partitioning first. Sorry for the inconvenience.");
    530530        }
    531         mr_asprintf(&tmp, "Could not mount device(s) %s- shall I abort?", these_failed);
     531        mr_asprintf(tmp, "Could not mount device(s) %s- shall I abort?", these_failed);
    532532
    533533        if (!ask_me_yes_or_no(tmp)) {
     
    570570* @return 0 for success, nonzero for failure.
    571571*/
    572 int mount_media()
    573 {
    574 char *mount_cmd = NULL;
    575 int i, res;
     572int mount_media() {
     573
     574    char *mount_cmd = NULL;
     575    char *p = NULL;
     576    int i, res;
    576577#ifdef __FreeBSD__
    577 char mdd[32];
    578 char *mddev = mdd;
     578    char mdd[32];
     579    char *mddev = mdd;
    579580#endif
    580581
    581 assert(bkpinfo != NULL);
    582 
    583     if (bkpinfo->backup_media_type == tape
    584         || bkpinfo->backup_media_type == udev) {
     582    if (bkpinfo->backup_media_type == tape || bkpinfo->backup_media_type == udev) {
    585583        log_msg(8, "Tape/udev. Therefore, no need to mount a media.");
    586584        return 0;
     
    595593        log_msg(2, "Mounting for NFS thingy");
    596594        log_msg(2, "isodir = %s", bkpinfo->isodir);
    597         if ((!bkpinfo->isodir[0] || !strcmp(bkpinfo->isodir, "/"))
    598             && am_I_in_disaster_recovery_mode()) {
    599             strcpy(bkpinfo->isodir, "/tmp/isodir");
     595        if (!strcmp(bkpinfo->isodir, "/") && am_I_in_disaster_recovery_mode()) {
     596            mr_free(bkpinfo->isodir);
     597            mr_asprintf(p, "/tmp/isodir");
     598            bkpinfo->isodir = p;
    600599            log_msg(1, "isodir is being set to %s", bkpinfo->isodir);
    601600        }
    602601#ifdef __FreeBSD__
    603         mr_asprintf(&mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
     602        mr_asprintf(mount_cmd, "/mnt/isodir/%s/%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number);
    604603        mddev = make_vn(mount_cmd);
    605604        mr_free(mount_cmd);
    606605
    607         mr_asprintf(&mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
     606        mr_asprintf(mount_cmd, "mount_cd9660 -r %s " MNT_CDROM, mddev);
    608607#else
    609         mr_asprintf(&mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     608        mr_asprintf(mount_cmd, "mount %s/%s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->nfs_remote_dir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    610609#endif
    611610
    612611    } else if (bkpinfo->backup_media_type == iso) {
    613612#ifdef __FreeBSD__
    614         mr_asprintf(&mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);
     613        mr_asprintf(mount_cmd, "%s/%s-%d.iso", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number);
    615614        mddev = make_vn(mount_cmd);
    616615        mr_free(mount_cmd);
    617616
    618         mr_asprintf(&mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
     617        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", mddev, MNT_CDROM);
    619618#else
    620         mr_asprintf(&mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
     619        mr_asprintf(mount_cmd, "mount %s/%s-%d.iso -t iso9660 -o loop,ro %s", bkpinfo->isodir, bkpinfo->prefix, g_current_media_number, MNT_CDROM);
    621620#endif
    622621    } else if (bkpinfo->backup_media_type == usb) {
    623         mr_asprintf(&mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);
     622        mr_asprintf(mount_cmd, "mount -t vfat %s %s", bkpinfo->media_device, MNT_CDROM);
    624623    } else if (strstr(bkpinfo->media_device, "/dev/")) {
    625624#ifdef __FreeBSD__
    626         mr_asprintf(&mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
     625        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
    627626#else
    628         mr_asprintf(&mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
     627        mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
    629628#endif
    630629    } else {
     
    638637
    639638#ifdef __FreeBSD__
    640         mr_asprintf(&mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
     639        mr_asprintf(mount_cmd, "mount_cd9660 -r %s %s", bkpinfo->media_device, MNT_CDROM);
    641640#else
    642         mr_asprintf(&mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
     641        mr_asprintf(mount_cmd, "mount %s -t iso9660 -o ro %s", bkpinfo->media_device, MNT_CDROM);
    643642#endif
    644643    }
     
    727726malloc_string(iso_mnt);
    728727malloc_string(iso_path);
    729 malloc_string(old_isodir);
    730728malloc_string(value);
    731729malloc_string(tmp);
     
    774772    mr_free(bkpinfo->prefix);
    775773    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    776         mr_asprintf(&tmp1, "%s", value);
     774        mr_asprintf(tmp1, "%s", value);
    777775    } else {
    778         mr_asprintf(&tmp1, "%s", STD_PREFIX);
     776        mr_asprintf(tmp1, "%s", STD_PREFIX);
    779777    }
    780778    bkpinfo->prefix = tmp1;
     
    784782    mr_free(bkpinfo->prefix);
    785783    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
    786         mr_asprintf(&tmp1, "%s", value);
     784        mr_asprintf(tmp1, "%s", value);
    787785    } else {
    788         mr_asprintf(&tmp1, "%s", STD_PREFIX);
     786        mr_asprintf(tmp1, "%s", STD_PREFIX);
    789787    }
    790788    bkpinfo->prefix = tmp1;
     
    798796        }
    799797        mr_free(bkpinfo->prefix);
    800         mr_asprintf(&tmp1, "%s", envtmp1);
     798        mr_asprintf(tmp1, "%s", envtmp1);
    801799        bkpinfo->prefix = tmp1;
    802800    }
     
    863861read_cfg_var(cfg_file, "acl", value);
    864862if (strstr(value, "TRUE")) {
    865     mr_asprintf(&g_getfacl,"setfacl");
     863    mr_asprintf(g_getfacl,"setfacl");
    866864    log_msg(1, "We will restore ACLs");
    867865    if (! find_home_of_exe("setfacl")) {
     
    871869read_cfg_var(cfg_file, "xattr", value);
    872870if (strstr(value, "TRUE")) {
    873     mr_asprintf(&g_getfattr,"setfattr");
     871    mr_asprintf(g_getfattr,"setfattr");
    874872    log_msg(1, "We will restore XATTRs");
    875873    if (! find_home_of_exe("setfattr")) {
     
    968966    * isodir in disaster recovery mode
    969967    */
    970     strcpy(old_isodir, bkpinfo->isodir);
     968    mr_asprintf(old_isodir, "%s", bkpinfo->isodir);
    971969    read_cfg_var(g_mondo_cfg_file, "iso-mnt", iso_mnt);
    972970    read_cfg_var(g_mondo_cfg_file, "isodir", iso_path);
    973     sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
     971    mr_free(bkpinfo->isodir);
     972    mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path);
     973    bkpinfo->isodir = tmp1;
    974974    if (!bkpinfo->isodir[0]) {
    975         strcpy(bkpinfo->isodir, old_isodir);
     975        mr_free(bkpinfo->isodir);
     976        bkpinfo->isodir = old_isodir;
     977    } else {
     978        mr_free(old_isodir);
    976979    }
    977980    if (!bkpinfo->disaster_recovery) {
    978981        if (strcmp(old_isodir, bkpinfo->isodir)) {
    979             log_it
    980                 ("user nominated isodir differs from archive, keeping user's choice: %s %s\n",
    981                 old_isodir, bkpinfo->isodir);
    982             strcpy(bkpinfo->isodir, old_isodir);
     982            log_it("user nominated isodir %s differs from archive, keeping user's choice: %s\n", bkpinfo->isodir, old_isodir );
     983            mr_free(bkpinfo->isodir);
     984            bkpinfo->isodir = old_isodir;
     985        } else {
     986            mr_free(old_isodir);
    983987        }
    984988    }
    985989    read_cfg_var(g_mondo_cfg_file, "iso-dev", g_isodir_device);
    986     log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir,
    987             g_isodir_device);
     990    log_msg(2, "isodir=%s; iso-dev=%s", bkpinfo->isodir, g_isodir_device);
     991
    988992    if (bkpinfo->disaster_recovery) {
    989993        if (is_this_device_mounted(g_isodir_device)) {
    990994            log_msg(2, "NB: isodir is already mounted");
    991995            /* Find out where it's mounted */
    992             mr_asprintf(&command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device);
     996            mr_asprintf(command, "mount | grep -E '^%s' | tail -n1 | cut -d' ' -f3", g_isodir_device);
    993997            log_it("command = %s", command);
    994998            log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
     
    9971001        } else {
    9981002            sprintf(iso_mnt, "/tmp/isodir");
    999             mr_asprintf(&tmp1, "mkdir -p %s", iso_mnt);
     1003            mr_asprintf(tmp1, "mkdir -p %s", iso_mnt);
    10001004            run_program_and_log_output(tmp1, 5);
    10011005            mr_free(tmp1);
    10021006
    1003             mr_asprintf(&tmp1, "mount %s %s", g_isodir_device, iso_mnt);
     1007            mr_asprintf(tmp1, "mount %s %s", g_isodir_device, iso_mnt);
    10041008            if (run_program_and_log_output(tmp1, 3)) {
    10051009                log_msg(1,
     
    10071011                bkpinfo->backup_media_type = cdr;
    10081012                strcpy(bkpinfo->media_device, "/dev/cdrom");    /* superfluous */
    1009                 bkpinfo->isodir[0] = iso_mnt[0] = iso_path[0] = '\0';
     1013                iso_mnt[0] = iso_path[0] = '\0';
    10101014                if (mount_media()) {
    10111015                    mr_free(tmp1);
    1012                     fatal_error
    1013                         ("Unable to mount isodir. Failed to mount CD-ROM as well.");
     1016                    fatal_error("Unable to mount isodir. Failed to mount CD-ROM as well.");
    10141017                } else {
    1015                     log_msg(1,
    1016                             "You backed up to disk, then burned some CDs.");
     1018                    log_msg(1, "You backed up to disk, then burned some CDs.");
    10171019                }
    10181020            }
     
    10211023        /* bkpinfo->isodir should now be the true path to prefix-1.iso etc... */
    10221024        if (bkpinfo->backup_media_type == iso) {
    1023             sprintf(bkpinfo->isodir, "%s%s", iso_mnt, iso_path);
     1025            mr_free(bkpinfo->isodir);
     1026            mr_asprintf(tmp1, "%s%s", iso_mnt, iso_path);
     1027            bkpinfo->isodir = tmp1;
    10241028        }
    10251029    }
     
    10471051paranoid_free(iso_mnt);
    10481052paranoid_free(iso_path);
    1049 paranoid_free(old_isodir);
    10501053return (0);
    10511054
     
    11051108    unlink(FILELIST_FULL_STUB);
    11061109    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    1107         mr_asprintf(&command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
     1110        mr_asprintf(command, "tar -b %ld -zxf %s ./%s ./%s ./%s ./%s ./%s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11081111        log_msg(1, "tarcommand = %s", command);
    11091112        run_program_and_log_output(command, 1);
     
    11131116            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    11141117            log_msg(2, "pre-2.2.4 compatible mode on");
    1115             mr_asprintf(&command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
     1118            mr_asprintf(command, "tar -b %ld -zxf %s %s %s %s %s %s", bkpinfo->internal_tape_block_size, bkpinfo->media_device, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11161119            log_msg(1, "tarcommand = %s", command);
    11171120            run_program_and_log_output(command, 1);
     
    11191122        }
    11201123    } else {
    1121         log_msg(2,
    1122             "Calling insist_on_this_cd_number; bkpinfo->isodir=%s",
    1123             bkpinfo->isodir);
     1124        log_msg(2, "Calling insist_on_this_cd_number; bkpinfo->isodir=%s", bkpinfo->isodir);
    11241125        insist_on_this_cd_number(1);
    11251126        log_msg(2, "Back from iotcn");
    11261127        run_program_and_log_output("mount", 1);
    1127         mr_asprintf(&command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
     1128        mr_asprintf(command, "tar -zxf %s/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11281129
    11291130        log_msg(1, "tarcommand = %s", command);
     
    11341135            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    11351136            log_msg(2, "pre-2.2.4 compatible mode on");
    1136             mr_asprintf(&command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
     1137            mr_asprintf(command, "tar -zxf %s/images/all.tar.gz %s %s %s %s %s", MNT_CDROM, MOUNTLIST_FNAME_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB, MONDO_CFG_FILE_STUB);
    11371138
    11381139            log_msg(1, "tarcommand = %s", command);
     
    11491150        }
    11501151    }
    1151     mr_asprintf(&command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file);
     1152    mr_asprintf(command, "cp -f %s %s", MONDO_CFG_FILE_STUB, g_mondo_cfg_file);
    11521153    run_program_and_log_output(command, FALSE);
    11531154    mr_free(command);
    11541155
    1155     mr_asprintf(&command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt);
     1156    mr_asprintf(command, "cp -f %s/%s %s", bkpinfo->tmpdir, BIGGIELIST_TXT_STUB, g_biggielist_txt);
    11561157    log_msg(1, "command = %s", command);
    11571158    paranoid_system(command);
    11581159    mr_free(command);
    11591160
    1160     mr_asprintf(&command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full);
     1161    mr_asprintf(command, "ln -sf %s/%s %s", bkpinfo->tmpdir, FILELIST_FULL_STUB, g_filelist_full);
    11611162    log_msg(1, "command = %s", command);
    11621163    paranoid_system(command);
     
    11701171    &&
    11711172    ask_me_yes_or_no("Do you want to retrieve the mountlist as well?")) {
    1172         mr_asprintf(&command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir);
     1173        mr_asprintf(command, "ln -sf %s/%s /tmp", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir);
    11731174        paranoid_system(command);
    11741175        mr_free(command);
     
    11951196        log_to_screen("Pre-processing filelist");
    11961197        if (!does_file_exist(g_biggielist_txt)) {
    1197             mr_asprintf(&command, "echo -n > %s", g_biggielist_txt);
     1198            mr_asprintf(command, "echo -n > %s", g_biggielist_txt);
    11981199            paranoid_system(command);
    11991200            mr_free(command);
    12001201        }
    1201         mr_asprintf(&command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs);
     1202        mr_asprintf(command, "grep -E '^/dev/.*' %s > %s", g_biggielist_txt, g_filelist_imagedevs);
    12021203        paranoid_system(command);
    12031204        mr_free(command);
     
    12761277    assert_string_is_neither_NULL_nor_zerolength(filename);
    12771278
    1278     mr_asprintf(&tmp, "%s/%s", path_root, filename);
    1279     mr_asprintf(&command, "cp -f %s %s.pristine", tmp, tmp);
     1279    mr_asprintf(tmp, "%s/%s", path_root, filename);
     1280    mr_asprintf(command, "cp -f %s %s.pristine", tmp, tmp);
    12801281    mr_free(tmp);
    12811282
     
    13341335     * the current /dev location
    13351336     */
    1336     mr_asprintf(&cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
     1337    mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
    13371338    run_program_and_log_output(cmd, 3);
    13381339    paranoid_free(cmd);
     
    13611362#ifdef __FreeBSD__
    13621363    else if (!strcmp(name, "BOOT0")) {
    1363         mr_asprintf(&tmp, "boot0cfg -B %s", device);
     1364        mr_asprintf(tmp, "boot0cfg -B %s", device);
    13641365        res = run_program_and_log_output(tmp, FALSE);
    13651366        paranoid_free(tmp);
    13661367    } else {
    1367         mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
     1368        mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
    13681369        if (!system(tmp)) {
    13691370            mr_free(tmp);
    1370             mr_asprintf(&tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
     1371            mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
    13711372            res = run_program_and_log_output(tmp, 3);
    13721373        } else {
     
    14521453    assert_string_is_neither_NULL_nor_zerolength(bd);
    14531454    strcpy(editor, find_my_editor());
    1454     mr_asprintf(&boot_device, "%s", bd);
     1455    mr_asprintf(boot_device, "%s", bd);
    14551456
    14561457    if (offer_to_run_stabgrub
     
    14691470                continue;
    14701471            }
    1471             mr_asprintf(&command, "stabgrub-me %s", p);
     1472            mr_asprintf(command, "stabgrub-me %s", p);
    14721473            mr_free(p);
    14731474
     
    14891490                newtSuspend();
    14901491            }
    1491             mr_asprintf(&tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
     1492            mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
    14921493            paranoid_system(tmp);
    14931494            mr_free(tmp);
    14941495
    1495             mr_asprintf(&tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
     1496            mr_asprintf(tmp, "chroot %s %s /etc/mtab", MNT_RESTORING, editor);
    14961497            paranoid_system(tmp);
    14971498            mr_free(tmp);
    14981499
    1499             mr_asprintf(&tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
     1500            mr_asprintf(tmp, "chroot %s %s /boot/grub/menu.lst", MNT_RESTORING, editor);
    15001501            paranoid_system(tmp);
    15011502            mr_free(tmp);
    15021503
    1503             mr_asprintf(&tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
     1504            mr_asprintf(tmp, "chroot %s %s /boot/grub/device.map", MNT_RESTORING, editor);
    15041505            paranoid_system(tmp);
    15051506            mr_free(tmp);
     
    15131514        if (!run_program_and_log_output("which grub-MR", FALSE)) {
    15141515            log_msg(1, "Yay! grub-MR found...");
    1515             mr_asprintf(&command, "grub-MR %s /tmp/mountlist.txt", boot_device);
     1516            mr_asprintf(command, "grub-MR %s /tmp/mountlist.txt", boot_device);
    15161517            log_msg(1, "command = %s", command);
    15171518        } else {
    1518             mr_asprintf(&command, "chroot " MNT_RESTORING " grub-install %s", boot_device);
     1519            mr_asprintf(command, "chroot " MNT_RESTORING " grub-install %s", boot_device);
    15191520            log_msg(1, "WARNING - grub-MR not found; using grub-install");
    15201521        }
     
    15911592                            0,
    15921593                            "Modifying fstab and elilo.conf...                             ");
    1593         mr_asprintf(&command, "stabelilo-me");
     1594        mr_asprintf(command, "stabelilo-me");
    15941595        res = run_program_and_log_output(command, 3);
    15951596        mr_free(command);
     
    16021603                    newtSuspend();
    16031604                }
    1604                 mr_asprintf(&tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
     1605                mr_asprintf(tmp, "chroot %s %s /etc/fstab", MNT_RESTORING, editor);
    16051606                paranoid_system(tmp);
    16061607                mr_free(tmp);
    16071608
    1608                 mr_asprintf(&tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor);
     1609                mr_asprintf(tmp, "chroot %s %s /etc/elilo.conf", MNT_RESTORING, editor);
    16091610                paranoid_system(tmp);
    16101611                mr_free(tmp);
     
    16671668                            0,
    16681669                            "Modifying fstab and lilo.conf, and running LILO...                             ");
    1669         mr_asprintf(&command, "stablilo-me");
     1670        mr_asprintf(command, "stablilo-me");
    16701671        res = run_program_and_log_output(command, 3);
    16711672        mr_free(command);
     
    16781679                    newtSuspend();
    16791680                }
    1680                 mr_asprintf(&tmp, "%s " MNT_RESTORING "/etc/fstab", editor);
     1681                mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor);
    16811682                paranoid_system(tmp);
    16821683                mr_free(tmp);
    16831684
    1684                 mr_asprintf(&tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor);
     1685                mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/lilo.conf", editor);
    16851686                paranoid_system(tmp);
    16861687                mr_free(tmp);
     
    17701771
    17711772    strcpy(editor, find_my_editor());
    1772     mr_asprintf(&boot_device, "%s", bd);
     1773    mr_asprintf(boot_device, "%s", bd);
    17731774
    17741775    if (offer_to_hack_scripts
     
    17831784                    newtSuspend();
    17841785                }
    1785                 mr_asprintf(&tmp, "%s " MNT_RESTORING "/etc/fstab", editor);
     1786                mr_asprintf(tmp, "%s " MNT_RESTORING "/etc/fstab", editor);
    17861787                paranoid_system(tmp);
    17871788                mr_free(tmp);
     
    17981799                continue;
    17991800            }
    1800             mr_asprintf(&command, "stabraw-me %s", p);
     1801            mr_asprintf(command, "stabraw-me %s", p);
    18011802            mr_free(p);
    18021803
     
    18121813    } else {
    18131814        /* nuke mode */
    1814         mr_asprintf(&command, "raw-MR %s /tmp/mountlist.txt", boot_device);
     1815        mr_asprintf(command, "raw-MR %s /tmp/mountlist.txt", boot_device);
    18151816        log_msg(2, "run_raw_mbr() --- command='%s'", command);
    18161817
     
    19391940    for (i = 0; i < 20; i++) {
    19401941        g_current_progress = i;
    1941         mr_asprintf(&tmp, "You have %d seconds left to abort.", 20 - i);
     1942        mr_asprintf(tmp, "You have %d seconds left to abort.", 20 - i);
    19421943        update_progress_form(tmp);
    19431944        mr_free(tmp);
     
    19911992    paranoid_system("sync");
    19921993
    1993     mr_asprintf(&tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
     1994    mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
    19941995    if (run_program_and_log_output(tmp, FALSE)) {
    19951996        log_msg(1,
     
    20102011            continue;
    20112012        }
    2012         mr_asprintf(&tmp, "Unmounting device %s  ", mountlist->el[lino].device);
     2013        mr_asprintf(tmp, "Unmounting device %s  ", mountlist->el[lino].device);
    20132014
    20142015        update_progress_form(tmp);
     
    20162017        if (is_this_device_mounted(mountlist->el[lino].device)) {
    20172018            if (!strcmp(mountlist->el[lino].mountpoint, "swap")) {
    2018                 mr_asprintf(&command, "swapoff %s", mountlist->el[lino].device);
     2019                mr_asprintf(command, "swapoff %s", mountlist->el[lino].device);
    20192020            } else {
    20202021                if (!strcmp(mountlist->el[lino].mountpoint, "/1")) {
    2021                     mr_asprintf(&command, "umount %s/", MNT_RESTORING);
     2022                    mr_asprintf(command, "umount %s/", MNT_RESTORING);
    20222023                    log_msg(3,
    20232024                            "Well, I know a certain kitty-kitty who'll be sleeping with Mommy tonight...");
    20242025                } else {
    2025                     mr_asprintf(&command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);
     2026                    mr_asprintf(command, "umount " MNT_RESTORING "%s", mountlist->el[lino].mountpoint);
    20262027
    20272028                    /* To support latest Ubuntu where /var is a separate FS
     
    20902091    }
    20912092
    2092     mr_asprintf(&command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
     2093    mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx ./%s ./%s ./%s ./%s ./%s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
    20932094    log_msg(2, "command = '%s'", command);
    20942095    res = run_program_and_log_output(command, -1);
     
    21012102            /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    21022103            log_msg(2, "pre-2.2.4 compatible mode on");
    2103             mr_asprintf(&command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
     2104            mr_asprintf(command, "dd if=%s bs=%ld count=%ld 2> /dev/null | tar -zx %s %s %s %s %s", dev, bkpinfo->internal_tape_block_size, 1024L * 1024 * 32 / bkpinfo->internal_tape_block_size, MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);
    21042105            log_msg(2, "command = '%s'", command);
    21052106            res = run_program_and_log_output(command, -1);
     
    21482149    log_msg(2, "gcffa --- starting");
    21492150    log_to_screen("I'm thinking...");
    2150     mr_asprintf(&mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir);
     2151    mr_asprintf(mountpt, "%s/mount.bootdisk", bkpinfo->tmpdir);
    21512152    device[0] = '\0';
    21522153    chdir(bkpinfo->tmpdir);
    2153     mr_asprintf(&cfg_file, "%s", MONDO_CFG_FILE_STUB);
     2154    mr_asprintf(cfg_file, "%s", MONDO_CFG_FILE_STUB);
    21542155    unlink(cfg_file);           // cfg_file[] is missing the '/' at the start, FYI, by intent
    21552156    mr_free(cfg_file);
     
    21572158    unlink(FILELIST_FULL_STUB);
    21582159    unlink(BIGGIELIST_TXT_STUB);
    2159     mr_asprintf(&command, "mkdir -p %s", mountpt);
     2160    mr_asprintf(command, "mkdir -p %s", mountpt);
    21602161    run_program_and_log_output(command, FALSE);
    21612162    mr_free(command);
    21622163
    2163     mr_asprintf(&cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB);
    2164     mr_asprintf(&mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
     2164    mr_asprintf(cfg_file, "%s/%s", bkpinfo->tmpdir, MONDO_CFG_FILE_STUB);
     2165    mr_asprintf(mountlist_file, "%s/%s", bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
    21652166    log_msg(2, "mountpt = %s; cfg_file=%s", mountpt, cfg_file);
    21662167    mr_free(mountpt);
     
    21922193                log_msg(2, "media_device is blank; assuming %s");
    21932194            }
    2194             mr_asprintf(&tmp, "%s", bkpinfo->media_device);
     2195            mr_asprintf(tmp, "%s", bkpinfo->media_device);
    21952196            if (extract_cfg_file_and_mountlist_from_tape_dev
    21962197                (bkpinfo->media_device)) {
     
    22312232                log_msg(2,
    22322233                        "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz");
    2233                 mr_asprintf(&command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);   // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
     2234                mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);    // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
    22342235                run_program_and_log_output(command, TRUE);
    22352236                mr_free(command);
     
    22382239                    /* Doing that allow us to remain compatible with pre-2.2.5 versions */
    22392240                    log_msg(2, "pre-2.2.4 compatible mode on");
    2240                     mr_asprintf(&command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB); // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
     2241                    mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz %s %s %s %s %s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);  // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
    22412242                    run_program_and_log_output(command, TRUE);
    22422243                    mr_free(command);
     
    22512252    if (does_file_exist(MONDO_CFG_FILE_STUB)) {
    22522253        log_msg(1, "gcffa --- great! We've got the config file");
    2253         mr_asprintf(&tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB);
    2254         mr_asprintf(&command, "cp -f %s %s", tmp, cfg_file);
     2254        mr_asprintf(tmp, "%s/%s", call_program_and_get_last_line_of_output("pwd"), MONDO_CFG_FILE_STUB);
     2255        mr_asprintf(command, "cp -f %s %s", tmp, cfg_file);
    22552256        log_it("%s",command);
    22562257        if (strcmp(tmp, cfg_file) && run_program_and_log_output(command, 1)) {
     
    22612262        mr_free(command);
    22622263
    2263         mr_asprintf(&command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"),
     2264        mr_asprintf(command, "cp -f %s/%s %s", call_program_and_get_last_line_of_output("pwd"),
    22642265            MOUNTLIST_FNAME_STUB, mountlist_file);
    22652266        log_it("%s",command);
     
    22712272
    22722273                mr_free(command);
    2273                 mr_asprintf(&command, "cp -f %s %s", mountlist_file, g_mountlist_fname);
     2274                mr_asprintf(command, "cp -f %s %s", mountlist_file, g_mountlist_fname);
    22742275                if (run_program_and_log_output(command, 1)) {
    22752276                    log_msg(1, "Failed to copy mountlist to /tmp");
     
    22772278                    log_msg(1, "Copied mountlist to /tmp as well OK");
    22782279                    mr_free(command);
    2279                     mr_asprintf(&command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
     2280                    mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
    22802281                    run_program_and_log_output(command, 1);
    22812282                }
     
    23012302            /* Is this code really useful ??? */
    23022303        if (extract_mountlist_stub) {
    2303             mr_asprintf(&command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
     2304            mr_asprintf(command, "cp -f %s %s/%s", MOUNTLIST_FNAME_STUB, bkpinfo->tmpdir, MOUNTLIST_FNAME_STUB);
    23042305            run_program_and_log_output(command, FALSE);
    23052306            mr_free(command);
     
    23072308    }
    23082309
    2309     mr_asprintf(&command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB);
     2310    mr_asprintf(command, "cp -f %s /%s", cfg_file, MONDO_CFG_FILE_STUB);
    23102311    mr_free(cfg_file);
    23112312
     
    23142315
    23152316    if (extract_mountlist_stub) {
    2316         mr_asprintf(&command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB);
     2317        mr_asprintf(command, "cp -f %s /%s", mountlist_file, MOUNTLIST_FNAME_STUB);
    23172318        run_program_and_log_output(command, FALSE);
    23182319        mr_free(command);
     
    23202321    mr_free(mountlist_file);
    23212322
    2322     mr_asprintf(&command, "cp -f etc/raidtab /etc/");
     2323    mr_asprintf(command, "cp -f etc/raidtab /etc/");
    23232324    run_program_and_log_output(command, FALSE);
    23242325    mr_free(command);
    23252326
    23262327    if (extract_i_want_my_lvm) {
    2327         mr_asprintf(&command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
     2328        mr_asprintf(command, "cp -f %s /tmp/",IWANTMYLVM_STUB);
    23282329        run_program_and_log_output(command, FALSE);
    23292330        mr_free(command);
     
    23822383                }
    23832384                log_msg(1,"Sync'ing %s (i=%d)", raidlist->el[i].raid_device, i);
    2384                 mr_asprintf(&screen_message, "Sync'ing %s", raidlist->el[i].raid_device);
     2385                mr_asprintf(screen_message, "Sync'ing %s", raidlist->el[i].raid_device);
    23852386                open_evalcall_form(screen_message);
    23862387                mr_free(screen_message);
  • branches/2.2.10/mondo/src/mondorestore/mondorestore.c

    r2321 r2323  
    280280        }
    281281        if (g_ISO_restore_mode) {
    282             mr_asprintf(&tmp, "umount %s", bkpinfo->isodir);
     282            mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
    283283            run_program_and_log_output(tmp, FALSE);
    284284            mr_free(tmp);
     
    361361
    362362    /* Clean up blkid cache file if they exist */
    363     mr_asprintf(&tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
     363    mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
    364364    (void)unlink(tmp1);
    365365    paranoid_free(tmp1);
    366     mr_asprintf(&tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
     366    mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
    367367    (void)unlink(tmp1);
    368368    paranoid_free(tmp1);
     
    376376
    377377    /* Clean up multiconf cache file if they exist */
    378     mr_asprintf(&tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
     378    mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
    379379    (void)unlink(tmp1);
    380380    paranoid_free(tmp1);
    381381
    382382    /* Edit multipath.conf if needed to adapt wwid */
    383     mr_asprintf(&tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
     383    mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
    384384    if (does_file_exist(tmp1)) {
    385385        log_msg(2, "We may need to clean /etc/multipath.conf");
     
    391391
    392392    if (bkpinfo->restore_mode != nuke) {
    393         mr_asprintf(&editor, "%s", find_my_editor());
    394         mr_asprintf(&tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
     393        mr_asprintf(editor, "%s", find_my_editor());
     394        mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
    395395        popup_and_OK("You will now edit multipath.conf");
    396396        if (!g_text_mode) {
     
    490490        if (g_text_mode) {
    491491            save_mountlist_to_disk(mountlist, g_mountlist_fname);
    492             mr_asprintf(&tmp1, "%s %s", find_my_editor(), g_mountlist_fname);
     492            mr_asprintf(tmp1, "%s %s", find_my_editor(), g_mountlist_fname);
    493493            res = system(tmp1);
    494494            mr_free(tmp1);
     
    663663            strcpy(fstab_fname, "/tmp/fstab");
    664664        }
    665         mr_asprintf(&tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);
     665        mr_asprintf(tmp1, "label-partitions-as-necessary %s < %s >> %s 2>> %s", g_mountlist_fname, fstab_fname, MONDO_LOGFILE, MONDO_LOGFILE);
    666666        res = system(tmp1);
    667667        mr_free(tmp1);
     
    780780    assert(raidlist != NULL);
    781781
    782     mr_asprintf(&tmpA, "%s", "         ");
    783     mr_asprintf(&tmpB, "%s", "         ");
    784     mr_asprintf(&tmpC, "%s", "         ");
     782    mr_asprintf(tmpA, "%s", "         ");
     783    mr_asprintf(tmpB, "%s", "         ");
     784    mr_asprintf(tmpC, "%s", "         ");
    785785
    786786    log_msg(2, "nuke_mode --- starting");
     
    803803    }
    804804    if (!evaluate_mountlist(mountlist, tmpA, tmpB, tmpC)) {
    805         mr_asprintf(&tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);
     805        mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s %s %s\" Switch to Interactive Mode?", tmpA, tmpB, tmpC);
    806806        res = ask_me_yes_or_no(tmp);
    807807        mr_free(tmp);
     
    895895                        "Using tune2fs to identify your ext2,3 partitions");
    896896
    897     mr_asprintf(&tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);
     897    mr_asprintf(tmp, "label-partitions-as-necessary %s < /tmp/fstab", g_mountlist_fname);
    898898    res = run_program_and_log_output(tmp, TRUE);
    899899    mr_free(tmp);
     
    915915            ("Please visit our website at http://www.mondorescue.org for more information.");
    916916    } else {
    917         mr_asprintf(&tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
     917        mr_asprintf(tmp,"%s","Mondo has restored your system.\n\nPlease wait for the command prompt. Then remove the backup media and reboot.\n\nPlease visit our website at http://www.mondorescue.org for more information.");
    918918        popup_and_OK(tmp);
    919919        mr_free(tmp);
     
    11211121    if (!strncmp(biggiestruct.filename, "/dev/", 5))    // Whether NTFS or not :)
    11221122    {
    1123         mr_asprintf(&outfile_fname, "%s", biggiestruct.filename);
     1123        mr_asprintf(outfile_fname, "%s", biggiestruct.filename);
    11241124    } else {
    1125         mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
     1125        mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, biggiestruct.filename);
    11261126    }
    11271127
     
    11591159        use_ntfsprog_hack = TRUE;
    11601160        log_msg(2, "Calling ntfsclone in background because %s is an NTFS /dev entry", outfile_fname);
    1161         mr_asprintf(&sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
     1161        mr_asprintf(sz_devfile, "/tmp/%d.%d.000", (int) (random() % 32768),
    11621162                (int) (random() % 32768));
    11631163        mkfifo(sz_devfile, 0x770);
     
    12321232            mr_free(mds);
    12331233
    1234             mr_asprintf(&tmp, "Restoring from %s #%d", mds, g_current_media_number);
     1234            mr_asprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number);
    12351235            log_to_screen(tmp);
    12361236            mr_free(tmp);
     
    12391239            log_to_screen("Continuing to restore.");
    12401240        } else {
    1241             mr_asprintf(&tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));
     1241            mr_asprintf(tmp, "%s", slice_fname(bigfileno, sliceno, ARCHIVES_PATH, ""));
    12421242            if (does_file_exist(tmp) && length_of_file(tmp) == 0) {
    12431243                log_msg(2,
     
    12511251                    (slice_fname
    12521252                     (bigfileno, sliceno, ARCHIVES_PATH, "lzo"))) {
    1253                     mr_asprintf(&bzip2_command, "lzop");
     1253                    mr_asprintf(bzip2_command, "lzop");
    12541254                    strcpy(suffix, "lzo");
    12551255                } else
     
    12571257                        (slice_fname
    12581258                         (bigfileno, sliceno, ARCHIVES_PATH, "gz"))) {
    1259                     mr_asprintf(&bzip2_command, "gzip");
     1259                    mr_asprintf(bzip2_command, "gzip");
    12601260                    strcpy(suffix, "gz");
    12611261                } else
     
    12631263                        (slice_fname
    12641264                         (bigfileno, sliceno, ARCHIVES_PATH, "bz2"))) {
    1265                     mr_asprintf(&bzip2_command, "bzip2");
     1265                    mr_asprintf(bzip2_command, "bzip2");
    12661266                    strcpy(suffix, "bz2");
    12671267                } else
     
    12691269                        (slice_fname
    12701270                         (bigfileno, sliceno, ARCHIVES_PATH, ""))) {
    1271                     mr_asprintf(&bzip2_command, "");
     1271                    mr_asprintf(bzip2_command, "");
    12721272                    strcpy(suffix, "");
    12731273                } else {
     
    12821282                        slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12831283            } else {
    1284                 mr_asprintf(&bzip2_command, "cat %s 2>> %s",
     1284                mr_asprintf(bzip2_command, "cat %s 2>> %s",
    12851285                        slice_fname(bigfileno, sliceno, ARCHIVES_PATH, suffix), MONDO_LOGFILE);
    12861286            }
    12871287            mds = media_descriptor_string(bkpinfo->backup_media_type);
    1288             mr_asprintf(&tmp, "Working on %s #%d, file #%ld, slice #%ld    ", mds, g_current_media_number, bigfileno + 1, sliceno);
     1288            mr_asprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld    ", mds, g_current_media_number, bigfileno + 1, sliceno);
    12891289            mr_free(mds);
    12901290            log_msg(2, tmp);
     
    13211321    if (use_ntfsprog_hack) {
    13221322        log_msg(3, "Waiting for ntfsclone to finish");
    1323         mr_asprintf(&tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
     1323        mr_asprintf(tmp, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    13241324        while (system(tmp) == 0) {
    13251325            sleep(1);
     
    14521452    if (use_ntfsprog) {
    14531453        g_loglevel = 4;
    1454         mr_asprintf(&outfile_fname, "%s", orig_bf_fname);
     1454        mr_asprintf(outfile_fname, "%s", orig_bf_fname);
    14551455        use_ntfsprog_hack = TRUE;
    14561456        log_msg(2, "Calling ntfsclone in background because %s is a /dev entry", outfile_fname);
    1457         mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
     1457        mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir, (int) (random() % 32768), (int) (random() % 32768));
    14581458        mkfifo(sz_devfile, 0x770);
    14591459        strcpy(ntfsprog_fifo, sz_devfile);
     
    14751475        if (!strncmp(orig_bf_fname, "/dev/", 5))    {
    14761476            // non-NTFS partition
    1477             mr_asprintf(&outfile_fname, "%s", orig_bf_fname);
     1477            mr_asprintf(outfile_fname, "%s", orig_bf_fname);
    14781478        } else {
    14791479            // biggiefile
    1480             mr_asprintf(&outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);
     1480            mr_asprintf(outfile_fname, "%s/%s", bkpinfo->restore_path, orig_bf_fname);
    14811481        }
    14821482        use_ntfsprog_hack = FALSE;
     
    14921492    if (dummy_restore) {
    14931493        mr_free(outfile_fname);
    1494         mr_asprintf(&outfile_fname, "/dev/null");
     1494        mr_asprintf(outfile_fname, "/dev/null");
    14951495    }
    14961496
    14971497    if (!bkpinfo->zip_exe[0]) {
    1498         mr_asprintf(&command, "cat > \"%s\"", file_to_openout);
     1498        mr_asprintf(command, "cat > \"%s\"", file_to_openout);
    14991499    } else {
    1500         mr_asprintf(&command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);
     1500        mr_asprintf(command, "%s -dc > \"%s\" 2>> %s", bkpinfo->zip_exe, file_to_openout, MONDO_LOGFILE);
    15011501        if (strcmp(bkpinfo->zip_exe, "gzip") == 0) {
    15021502            /* Ignore SIGPIPE for gzip as it causes errors on big files
     
    15681568    if (use_ntfsprog_hack) {
    15691569        log_msg(3, "Waiting for ntfsclone to finish");
    1570         mr_asprintf(&tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
     1570        mr_asprintf(tmp1, " ps | grep \" ntfsclone \" | grep -v grep > /dev/null 2> /dev/null");
    15711571        while (system(tmp1) == 0) {
    15721572            sleep(1);
     
    16371637    log_msg(5, "Entering");
    16381638    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    1639     mr_asprintf(&command, "mkdir -p %s/tmp", MNT_RESTORING);
     1639    mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING);
    16401640    run_program_and_log_output(command, 9);
    16411641    paranoid_free(command);
    16421642
    1643     mr_asprintf(&filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);
     1643    mr_asprintf(filelist_name, MNT_CDROM "/archives/filelist.%ld", current_tarball_number);
    16441644    if (length_of_file(filelist_name) <= 2) {
    16451645        log_msg(2, "There are _zero_ files in filelist '%s'", filelist_name);
     
    16541654        log_msg(3, "length_of_file(%s) = %llu", tarball_fname, length_of_file(tarball_fname));
    16551655        log_msg(3, "count_lines_in_file(%s) = %llu", tarball_fname, count_lines_in_file(tarball_fname));
    1656         mr_asprintf(&tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);
     1656        mr_asprintf(tmp, "Unable to restore fileset #%ld (CD I/O error)", current_tarball_number);
    16571657        log_to_screen(tmp);
    16581658        mr_free(tmp);
     
    16631663
    16641664    if (filelist) {
    1665         mr_asprintf(&filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);
     1665        mr_asprintf(filelist_subset_fname, "/tmp/filelist-subset-%ld.tmp", current_tarball_number);
    16661666        if ((matches =
    16671667             save_filelist_entries_in_common(filelist_name, filelist,
     
    16721672            log_msg(3, "Saved fileset %ld's subset to %s", current_tarball_number, filelist_subset_fname);
    16731673        }
    1674         mr_asprintf(&screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);
     1674        mr_asprintf(screen_message, "Tarball #%ld --- %ld matches", current_tarball_number, matches);
    16751675        log_to_screen(screen_message);
    16761676        mr_free(screen_message);
     
    16801680    if (filelist == NULL || matches > 0) {
    16811681        if (g_getfattr) {
    1682             mr_asprintf(&xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
     1682            mr_asprintf(xattr_fname, XATTR_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
    16831683        }
    16841684        if (g_getfacl) {
    1685             mr_asprintf(&acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
     1685            mr_asprintf(acl_fname, ACL_LIST_FNAME_RAW_SZ, MNT_CDROM "/archives", current_tarball_number);
    16861686        }
    16871687        if (strstr(tarball_fname, ".bz2")) {
    1688             mr_asprintf(&executable, "bzip2");
     1688            mr_asprintf(executable, "bzip2");
    16891689        } else if (strstr(tarball_fname, ".gz")) {
    1690             mr_asprintf(&executable, "gzip");
     1690            mr_asprintf(executable, "gzip");
    16911691        } else if (strstr(tarball_fname, ".lzo")) {
    1692             mr_asprintf(&executable, "lzop");
     1692            mr_asprintf(executable, "lzop");
    16931693        }
    16941694        if (executable) {
    1695             mr_asprintf(&tmp, "which %s > /dev/null 2> /dev/null", executable);
     1695            mr_asprintf(tmp, "which %s > /dev/null 2> /dev/null", executable);
    16961696            res = run_program_and_log_output(tmp, FALSE);
    16971697            mr_free(tmp);
     
    17021702            }
    17031703            tmp = executable;
    1704             mr_asprintf(&executable, "-P %s -Z", tmp);
     1704            mr_asprintf(executable, "-P %s -Z", tmp);
    17051705            mr_free(tmp);
    17061706        }
     
    17121712
    17131713        if (use_star) {
    1714             mr_asprintf(&command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
     1714            mr_asprintf(command, "star -x -force-remove -U " STAR_ACL_SZ " errctl= file=%s", tarball_fname);
    17151715            if (strstr(tarball_fname, ".bz2")) {
    17161716                mr_strcat(command, " -bz");
     
    17211721            } else {
    17221722                if (filelist_subset_fname != NULL) {
    1723                     mr_asprintf(&command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);
     1723                    mr_asprintf(command, "afio -i -M 8m -b %ld -c %ld %s -w '%s' %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, filelist_subset_fname, tarball_fname);
    17241724                } else {
    1725                     mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
     1725                    mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
    17261726                }
    17271727            }
     
    17301730
    17311731#undef BUFSIZE
    1732         mr_asprintf(&temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));
     1732        mr_asprintf(temp_log, "/tmp/%d.%d", (int) (random() % 32768), (int) (random() % 32768));
    17331733
    17341734        mr_strcat(command, " 2>> %s >> %s", temp_log, temp_log);
     
    17761776        }
    17771777        if (retval) {
    1778             mr_asprintf(&command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
     1778            mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
    17791779            system(command);
    17801780            paranoid_free(command);
     
    18651865   * in afio or someting; oh darn.. OK, use tmpfs :-)                         *
    18661866   ****************************************************************************/
    1867     mr_asprintf(&afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);
    1868     mr_asprintf(&filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);
    1869     mr_asprintf(&filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);
     1867    mr_asprintf(afio_fname, "/tmp/tmpfs/archive.tmp.%ld", current_tarball_number);
     1868    mr_asprintf(filelist_fname, "%s/filelist.%ld", bkpinfo->tmpdir, current_tarball_number);
     1869    mr_asprintf(filelist_subset_fname, "%s/filelist-subset-%ld.tmp", bkpinfo->tmpdir, current_tarball_number);
    18701870
    18711871    res = read_file_from_stream_to_file(afio_fname, size);
     
    18771877    }
    18781878    if (bkpinfo->compression_level == 0) {
    1879         mr_asprintf(&executable, "%s", "");
     1879        mr_asprintf(executable, "%s", "");
    18801880    } else {
    18811881        if (bkpinfo->use_star) {
    1882             mr_asprintf(&executable, "%s", " -bz");
     1882            mr_asprintf(executable, "%s", " -bz");
    18831883        } else {
    1884             mr_asprintf(&executable, "-P %s -Z", bkpinfo->zip_exe);
     1884            mr_asprintf(executable, "-P %s -Z", bkpinfo->zip_exe);
    18851885        }
    18861886    }
     
    18931893        if (strstr(tarball_fname, ".star.")) {
    18941894            use_star = TRUE;
    1895             mr_asprintf(&command, "star -t file=%s %s", afio_fname, executable);
     1895            mr_asprintf(command, "star -t file=%s %s", afio_fname, executable);
    18961896        } else {
    18971897            use_star = FALSE;
    1898             mr_asprintf(&command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);
     1898            mr_asprintf(command, "afio -t -M 8m -b %ld %s %s", TAPE_BLOCK_SIZE, executable, afio_fname);
    18991899        }
    19001900        mr_strcat(command, " > %s 2>> %s", filelist_fname, MONDO_LOGFILE);
     
    19271927    if (strstr(tarball_fname, ".star.")) {
    19281928        // star
    1929         mr_asprintf(&command, "star -x file=%s %s", afio_fname, executable);
     1929        mr_asprintf(command, "star -x file=%s %s", afio_fname, executable);
    19301930        if (filelist) {
    19311931            mr_strcat(command, " list=%s", filelist_subset_fname);
     
    19331933    } else {
    19341934        // afio
    1935         mr_asprintf(&command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);
     1935        mr_asprintf(command, "afio -i -M 8m -b %ld %s", TAPE_BLOCK_SIZE, executable);
    19361936        if (filelist) {
    19371937            mr_strcat(command, " -w %s", filelist_subset_fname);
     
    20262026    assert(bkpinfo != NULL);
    20272027
    2028     mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
     2028    mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
    20292029    if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) {
    20302030        log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set);
     
    20332033    read_cfg_var(g_mondo_cfg_file, "total-slices", tmp);
    20342034    total_slices = atol(tmp);
    2035     mr_asprintf(&tmp1, "Reassembling large files      ");
     2035    mr_asprintf(tmp1, "Reassembling large files      ");
    20362036    mvaddstr_and_log_it(g_currentY, 0, tmp1);
    20372037    mr_free(tmp1);
     
    20662066            } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
    20672067                insist_on_this_cd_number(++g_current_media_number);
    2068                 mr_asprintf(&tmp1, "Restoring from %s #%d", mds, g_current_media_number);
     2068                mr_asprintf(tmp1, "Restoring from %s #%d", mds, g_current_media_number);
    20692069                log_to_screen(tmp1);
    20702070                mr_free(tmp1);
     
    20812081        } else {
    20822082            just_changed_cds = FALSE;
    2083             mr_asprintf(&tmp1, "Restoring big file %ld", bigfileno + 1);
     2083            mr_asprintf(tmp1, "Restoring big file %ld", bigfileno + 1);
    20842084            update_progress_form(tmp1);
    20852085            mr_free(tmp1);
     
    20982098        fclose(fbw);
    20992099        if (g_getfattr) {
    2100             mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2100            mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    21012101            if (length_of_file(xattr_fname) > 0) {
    21022102                set_fattr_list(biggies_whose_EXATs_we_should_set, xattr_fname);
     
    21052105        }
    21062106        if (g_getfacl) {
    2107             mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
     2107            mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, ARCHIVES_PATH);
    21082108            if (length_of_file(acl_fname) > 0) {
    21092109                set_acl_list(biggies_whose_EXATs_we_should_set, acl_fname);
     
    21772177
    21782178    mds = media_descriptor_string(bkpinfo->backup_media_type);
    2179     mr_asprintf(&progress_str, "Restoring from %s #%d", mds, g_current_media_number);
     2179    mr_asprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number);
    21802180
    21812181    log_to_screen(progress_str);
     
    21892189        mr_free(progress_str);
    21902190
    2191         mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);
     2191        mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.bz2", current_tarball_number);
    21922192        if (!does_file_exist(tarball_fname)) {
    21932193            mr_free(tarball_fname);
    2194             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);
     2194            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.gz", current_tarball_number);
    21952195        }
    21962196        if (!does_file_exist(tarball_fname)) {
    21972197            mr_free(tarball_fname);
    2198             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);
     2198            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.lzo", current_tarball_number);
    21992199        }
    22002200        if (!does_file_exist(tarball_fname)) {
    22012201            mr_free(tarball_fname);
    2202             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);
     2202            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.afio.", current_tarball_number);
    22032203        }
    22042204        if (!does_file_exist(tarball_fname)) {
    22052205            mr_free(tarball_fname);
    2206             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);
     2206            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.bz2", current_tarball_number);
    22072207        }
    22082208        if (!does_file_exist(tarball_fname)) {
    22092209            mr_free(tarball_fname);
    2210             mr_asprintf(&tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);
     2210            mr_asprintf(tarball_fname, MNT_CDROM "/archives/%ld.star.", current_tarball_number);
    22112211        }
    22122212        if (!does_file_exist(tarball_fname)) {
     
    22242224            }
    22252225            g_current_media_number++;
    2226             mr_asprintf(&progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);
     2226            mr_asprintf(progress_str, "Restoring from %s #%d", media_descriptor_string(bkpinfo->backup_media_type), g_current_media_number);
    22272227            log_to_screen(progress_str);
    22282228        } else {
    2229             mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);
     2229            mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_tarball_number, mds, g_current_media_number);
    22302230            for (res = 999, attempts = 0; attempts < 3 && res != 0;
    22312231                 attempts++) {
     
    22352235                                              filelist);
    22362236            }
    2237             mr_asprintf(&tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);
     2237            mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ", mds, g_current_media_number, current_tarball_number);
    22382238            if (res) {
    22392239                mr_strcat(tmp1, "reported errors");
     
    23192319    total_slices = atol(tmp);
    23202320    if (g_getfattr) {
    2321         mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2321        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    23222322    }
    23232323    if (g_getfacl) {
    2324         mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2325     }
    2326     mr_asprintf(&tmp1, "Reassembling large files      ");
     2324        mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2325    }
     2326    mr_asprintf(tmp1, "Reassembling large files      ");
    23272327    mvaddstr_and_log_it(g_currentY, 0, tmp1);
    23282328    mr_free(tmp1);
    23292329
    2330     mr_asprintf(&biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
     2330    mr_asprintf(biggies_whose_EXATs_we_should_set, "%s/biggies-whose-EXATs-we-should-set", bkpinfo->tmpdir);
    23312331    if (!(fbw = fopen(biggies_whose_EXATs_we_should_set, "w"))) {
    23322332        log_msg(1, "Warning - cannot openout %s", biggies_whose_EXATs_we_should_set);
     
    23642364            p++;
    23652365        }
    2366         mr_asprintf(&tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);
     2366        mr_asprintf(tmp1, "Restoring big file %ld (%lld K)", current_bigfile_number + 1, biggie_size / 1024);
    23672367        update_progress_form(tmp1);
    23682368        mr_free(tmp1);
     
    24792479    run_program_and_log_output("pwd", 5);
    24802480
    2481     mr_asprintf(&progress_str, "Restoring from media #%d", g_current_media_number);
     2481    mr_asprintf(progress_str, "Restoring from media #%d", g_current_media_number);
    24822482    log_to_screen(progress_str);
    24832483    open_progress_form("Restoring from archives",
     
    25012501        update_progress_form(progress_str);
    25022502        if (g_getfattr) {
    2503             mr_asprintf(&xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
     2503            mr_asprintf(xattr_fname, "%s/xattr-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
    25042504            unlink(xattr_fname);
    25052505        }
    25062506        if (g_getfacl) {
    2507             mr_asprintf(&acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
     2507            mr_asprintf(acl_fname, "%s/acl-subset-%ld.tmp", bkpinfo->tmpdir, current_afioball_number);
    25082508            unlink(acl_fname);
    25092509        }
     
    25192519        retval += res;
    25202520        if (res) {
    2521             mr_asprintf(&tmp, "Fileset %ld - errors occurred", current_afioball_number);
     2521            mr_asprintf(tmp, "Fileset %ld - errors occurred", current_afioball_number);
    25222522            log_to_screen(tmp);
    25232523            mr_free(tmp);
     
    25342534
    25352535        mr_free(progress_str);
    2536         mr_asprintf(&progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);
     2536        mr_asprintf(progress_str, "Restoring from fileset #%ld on %s #%d", current_afioball_number, mds, g_current_media_number);
    25372537        mr_free(mds);
    25382538        res = read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr);
     
    25942594    g_current_media_number = 1;
    25952595    getcwd(cwd, MAX_STR_LEN - 1);
    2596     mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->restore_path);
     2596    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->restore_path);
    25972597    run_program_and_log_output(tmp, FALSE);
    25982598    mr_free(tmp);
     
    26662666{
    26672667    log_msg(0, "-------------- Mondo Restore v%s -------------", PACKAGE_VERSION);
    2668     log_msg(0,
    2669             "DON'T PANIC! Mondorestore logs almost everything, so please ");
    2670     log_msg(0,
    2671             "don't break out in a cold sweat just because you see a few  ");
    2672     log_msg(0,
    2673             "error messages in the log. Read them; analyze them; see if  ");
    2674     log_msg(0,
    2675             "they are significant; above all, verify your backups! Please");
    2676     log_msg(0,
    2677             "attach a compressed copy of this log to any e-mail you send ");
    2678     log_msg(0,
    2679             "to the Mondo mailing list when you are seeking technical    ");
    2680     log_msg(0,
    2681             "support. Without it, we can't help you.            - DevTeam");
    2682     log_msg(0,
    2683             "------------------------------------------------------------");
    2684     log_msg(0,
    2685             "BTW, despite (or perhaps because of) the wealth of messages,");
    2686     log_msg(0,
    2687             "some users are inclined to stop reading this log.  If Mondo ");
    2688     log_msg(0,
    2689             "stopped for some reason, chances are it's detailed here.    ");
    2690     log_msg(0,
    2691             "More than likely there's a message at the very end of this  ");
    2692     log_msg(0,
    2693             "log that will tell you what is wrong.  Please read it!      ");
    2694     log_msg(0,
    2695             "------------------------------------------------------------");
     2668    log_msg(0, "DON'T PANIC! Mondorestore logs almost everything, so please ");
     2669    log_msg(0, "don't break out in a cold sweat just because you see a few  ");
     2670    log_msg(0, "error messages in the log. Read them; analyze them; see if  ");
     2671    log_msg(0, "they are significant; above all, verify your backups! Please");
     2672    log_msg(0, "attach a compressed copy of this log to any e-mail you send ");
     2673    log_msg(0, "to the Mondo mailing list when you are seeking technical    ");
     2674    log_msg(0, "support. Without it, we can't help you.            - DevTeam");
     2675    log_msg(0, "------------------------------------------------------------");
     2676    log_msg(0, "BTW, despite (or perhaps because of) the wealth of messages,");
     2677    log_msg(0, "some users are inclined to stop reading this log.  If Mondo ");
     2678    log_msg(0, "stopped for some reason, chances are it's detailed here.    ");
     2679    log_msg(0, "More than likely there's a message at the very end of this  ");
     2680    log_msg(0, "log that will tell you what is wrong.  Please read it!      ");
     2681    log_msg(0, "------------------------------------------------------------");
    26962682}
    26972683
     
    27682754
    27692755    /* Backup original mountlist.txt */
    2770     mr_asprintf(&tmp, "%s.orig", g_mountlist_fname);
     2756    mr_asprintf(tmp, "%s.orig", g_mountlist_fname);
    27712757    if (!does_file_exist(g_mountlist_fname)) {
    27722758        log_msg(2, "%ld: Warning - g_mountlist_fname (%s) does not exist yet", __LINE__, g_mountlist_fname);
    27732759    } else if (!does_file_exist(tmp)) {
    27742760        mr_free(tmp);
    2775         mr_asprintf(&tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);
     2761        mr_asprintf(tmp, "cp -f %s %s.orig", g_mountlist_fname, g_mountlist_fname);
    27762762        run_program_and_log_output(tmp, FALSE);
    27772763    }
     
    29482934        log_msg(2, "Still here. Yay.");
    29492935        if ((strlen(bkpinfo->tmpdir) > 0) && (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL)) {
    2950             mr_asprintf(&tmp, "rm -Rf %s/*", bkpinfo->tmpdir);
     2936            mr_asprintf(tmp, "rm -Rf %s/*", bkpinfo->tmpdir);
    29512937            run_program_and_log_output(tmp, FALSE);
    29522938            mr_free(tmp);
     
    29712957                && !is_this_device_mounted(bkpinfo->nfs_mount)) {
    29722958                log_msg(1, "Mounting nfs dir");
    2973                 sprintf(bkpinfo->isodir, "/tmp/isodir");
     2959                mr_free(bkpinfo->isodir);
     2960                mr_asprintf(tmp, "/tmp/isodir");
     2961                bkpinfo->isodir = tmp;
    29742962                run_program_and_log_output("mkdir -p /tmp/isodir", 5);
    2975                 mr_asprintf(&tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
     2963                mr_asprintf(tmp, "mount %s -t nfs -o nolock,ro /tmp/isodir", bkpinfo->nfs_mount);
    29762964                run_program_and_log_output(tmp, 1);
    29772965                mr_free(tmp);
     
    30703058      } else {
    30713059        log_msg(1, "Re-mounted partitions for post-nuke stuff");
    3072         mr_asprintf(&tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);
     3060        mr_asprintf(tmp, "post-nuke %s %d", bkpinfo->restore_path, retval);
    30733061        log_msg(2, "Calling '%s'", tmp);
    30743062        if ((res = run_program_and_log_output(tmp, 0))) {
     
    30913079    set_signals(FALSE);
    30923080    log_to_screen("Restore log (%s) copied to /var/log on your hard disk", MONDO_LOGFILE);
    3093     mr_asprintf(&tmp, "Mondo-restore is exiting (retval=%d)                                      ", retval);
     3081    mr_asprintf(tmp, "Mondo-restore is exiting (retval=%d)                                      ", retval);
    30943082    log_to_screen(tmp);
    30953083    mr_free(tmp);
    30963084
    3097     mr_asprintf(&tmp, "umount %s", bkpinfo->isodir);
     3085    mr_asprintf(tmp, "umount %s", bkpinfo->isodir);
    30983086    run_program_and_log_output(tmp, 5);
    30993087    mr_free(tmp);
     
    31053093    }                           // for b0rken distros
    31063094    if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) {
    3107         mr_asprintf(&tmp, "rm -Rf %s", bkpinfo->tmpdir);
     3095        mr_asprintf(tmp, "rm -Rf %s", bkpinfo->tmpdir);
    31083096        system(tmp);
    31093097        mr_free(tmp);
  • branches/2.2.10/mondo/test/test-mountlist.c

    r2320 r2323  
    5555bool ret = FALSE;
    5656
    57 mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
     57mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
    5858
    5959/* Globals */
     
    7171
    7272setup_newt_stuff();
    73 mr_asprintf(&g_mountlist_fname, "/tmp/mountlist.txt");
     73mr_asprintf(g_mountlist_fname, "/tmp/mountlist.txt");
    7474log_it("before mountlist");
    7575load_mountlist(mountlist, g_mountlist_fname);
     
    8282log_it("after edit_mountlist");
    8383
    84 mr_asprintf(&tmpA, "%s", "         ");
    85 mr_asprintf(&tmpB, "%s", "         ");
    86 mr_asprintf(&tmpC, "%s", "         ");
     84mr_asprintf(tmpA, "%s", "         ");
     85mr_asprintf(tmpB, "%s", "         ");
     86mr_asprintf(tmpC, "%s", "         ");
    8787ret = evaluate_mountlist(mountlist, tmpA, tmpB, tmpC);
    8888log_it("after evaluate_mountlist");
  • branches/2.2.10/mondo/test/test-truncname.c

    r2320 r2323  
    6666int i;
    6767
    68 mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
     68mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
    6969
    7070/* Globals */
     
    7676for (i=0; list[i] != NULL; i++) {
    7777    log_it("%d: partition %s ...",i, list[i]);
    78     mr_asprintf(&part,"%s",list[i]);
     78    mr_asprintf(part,"%s",list[i]);
    7979    disk = truncate_to_drive_name(part);
    8080    log_it("...belongs to disk %s",disk);
Note: See TracChangeset for help on using the changeset viewer.