Changeset 3185


Ignore:
Timestamp:
Sep 20, 2013, 2:29:57 PM (6 years ago)
Author:
bruno
Message:

Simplify the interface of mr_getline and mr_asprintf. With 3.1 compatibility now will allow backports from this branch into 3.0

Location:
branches/3.0/mondo
Files:
24 edited

Legend:

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

    r3150 r3185  
    200200
    201201    if (!does_file_exist(filelist)) {
    202         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
     202        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist", filelist);
    203203        log_to_screen(tmp);
    204204        paranoid_free(tmp);
     
    206206    }
    207207
    208     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     208    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    209209    if (system(tmp)) {
    210210        paranoid_free(tmp);
     
    213213    paranoid_free(tmp);
    214214
    215     mr_asprintf(&command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s",
     215    mr_asprintf(command, "star H=exustar list=%s -c -sparse " STAR_ACL_SZ " file=%s",
    216216            filelist, fname);
    217217    if (bkpinfo->use_lzo) {
     
    227227        log_msg(5, "command='%s'", command);
    228228        res = system(command);
    229         mr_asprintf(&tmp, "%s", last_line_of_file(MONDO_LOGFILE));
     229        mr_asprintf(tmp, "%s", last_line_of_file(MONDO_LOGFILE));
    230230        log_msg(1, "res=%d; tmp='%s'", res, tmp);
    231231        if (bkpinfo->use_star && (res == 254 || res == 65024)
     
    307307
    308308    if (!does_file_exist(filelist)) {
    309         mr_asprintf(&tmp, "(archive_this_fileset) - filelist %s does not exist",
     309        mr_asprintf(tmp, "(archive_this_fileset) - filelist %s does not exist",
    310310                filelist);
    311311        log_to_screen(tmp);
     
    313313        return (1);
    314314    }
    315     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     315    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    316316    if (system(tmp)) {
    317317        paranoid_free(tmp);
     
    322322
    323323    if (bkpinfo->compression_level > 0) {
    324         mr_asprintf(&tmp, "%s/do-not-compress-these", g_mondo_home);
     324        mr_asprintf(tmp, "%s/do-not-compress-these", g_mondo_home);
    325325        //       -b %ld, TAPE_BLOCK_SIZE
    326         mr_asprintf(&zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
     326        mr_asprintf(zipparams, "-Z -P %s -G %d -T 3k", bkpinfo->zip_exe,
    327327                bkpinfo->compression_level);
    328328        if (does_file_exist(tmp)) {
     
    333333        paranoid_free(tmp);
    334334    } else {
    335         mr_asprintf(&zipparams, "");
     335        mr_asprintf(zipparams, "");
    336336    }
    337337
     
    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",
     353    mr_asprintf(command, "afio -o -b %ld -M 16m %s %s < %s 2>> %s",
    354354            TAPE_BLOCK_SIZE, zipparams, fname, filelist, MONDO_LOGFILE);
    355355    paranoid_free(zipparams);
    356356
    357     mr_asprintf(&tmp, "echo hi > %s 2> /dev/null", fname);
     357    mr_asprintf(tmp, "echo hi > %s 2> /dev/null", fname);
    358358    if (system(tmp)) {
    359359        paranoid_free(tmp);
     
    545545                        "Calling MINDI to create boot+data disks");
    546546    open_evalcall_form("Calling MINDI to create boot+data disks");
    547     mr_asprintf(&tmp, "%s/filelist.full", bkpinfo->tmpdir);
     547    mr_asprintf(tmp, "%s/filelist.full", bkpinfo->tmpdir);
    548548    if (!does_file_exist(tmp)) {
    549549        mr_free(tmp);
    550         mr_asprintf(&tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
     550        mr_asprintf(tmp, "%s/tmpfs/filelist.full", bkpinfo->tmpdir);
    551551        if (!does_file_exist(tmp)) {
    552552            fatal_error
     
    557557    mr_free(tmp);
    558558
    559     mr_asprintf(&tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
    560     mr_asprintf(&last_filelist_number, "%s", last_line_of_file(tmp));
     559    mr_asprintf(tmp, "%s/LAST-FILELIST-NUMBER", bkpinfo->tmpdir);
     560    mr_asprintf(last_filelist_number, "%s", last_line_of_file(tmp));
    561561    mr_free(tmp);
    562562
    563563    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    564         mr_asprintf(&tape_size_sz, "%ld", bkpinfo->media_size);
     564        mr_asprintf(tape_size_sz, "%ld", bkpinfo->media_size);
    565565        ntapedev = get_non_rewind_dev(bkpinfo->media_device);
    566566        if ((bkpinfo->use_obdr) && (ntapedev != NULL)) {
     
    572572        }
    573573        paranoid_free(ntapedev);
    574         mr_asprintf(&tape_device, "%s", bkpinfo->media_device);
     574        mr_asprintf(tape_device, "%s", bkpinfo->media_device);
    575575    } else {
    576         mr_asprintf(&tape_size_sz, "%ld", 0L);;
    577         mr_asprintf(&tape_device, "");
     576        mr_asprintf(tape_size_sz, "%ld", 0L);;
     577        mr_asprintf(tape_device, "");
    578578    }
    579579    if (bkpinfo->use_lzo) {
    580         mr_asprintf(&use_lzo_sz, "yes");
     580        mr_asprintf(use_lzo_sz, "yes");
    581581    } else {
    582         mr_asprintf(&use_lzo_sz, "no");
     582        mr_asprintf(use_lzo_sz, "no");
    583583    }
    584584    if (bkpinfo->use_gzip) {
    585         mr_asprintf(&use_gzip_sz, "yes");
     585        mr_asprintf(use_gzip_sz, "yes");
    586586    } else {
    587         mr_asprintf(&use_gzip_sz, "no");
     587        mr_asprintf(use_gzip_sz, "no");
    588588    }
    589589    if (bkpinfo->use_star) {
    590         mr_asprintf(&use_star_sz, "yes");
     590        mr_asprintf(use_star_sz, "yes");
    591591    } else {
    592         mr_asprintf(&use_star_sz, "no");
     592        mr_asprintf(use_star_sz, "no");
    593593    }
    594594
    595595    if (bkpinfo->compression_level > 0) {
    596         mr_asprintf(&use_comp_sz, "yes");
     596        mr_asprintf(use_comp_sz, "yes");
    597597    } else {
    598         mr_asprintf(&use_comp_sz, "no");
    599     }
    600 
    601     mr_asprintf(&broken_bios_sz, "yes");    /* assume so */
     598        mr_asprintf(use_comp_sz, "no");
     599    }
     600
     601    mr_asprintf(broken_bios_sz, "yes"); /* assume so */
    602602    if (g_cd_recovery) {
    603         mr_asprintf(&cd_recovery_sz, "yes");
     603        mr_asprintf(cd_recovery_sz, "yes");
    604604    } else {
    605         mr_asprintf(&cd_recovery_sz, "no");
     605        mr_asprintf(cd_recovery_sz, "no");
    606606    }
    607607    if (bkpinfo->make_cd_use_lilo) {
    608         mr_asprintf(&use_lilo_sz, "yes");
     608        mr_asprintf(use_lilo_sz, "yes");
    609609    } else {
    610         mr_asprintf(&use_lilo_sz, "no");
     610        mr_asprintf(use_lilo_sz, "no");
    611611    }
    612612
     
    617617
    618618#ifdef __FreeBSD__
    619         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     619        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    620620               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    621621        if (!bootdev[0]) {
    622622            mr_free(bootdev);
    623             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     623            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    624624                   ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    625625        }
     
    627627        /* Linux */
    628628#ifdef __IA64__
    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 ' /boot/efi ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    631631#else
    632         mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     632        mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    633633               ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    634634#endif
     
    636636            mr_free(bootdev);
    637637#ifdef __IA64__
    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/efi ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    640640#else
    641             mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     641            mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    642642                   ("mount | grep ' /boot ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    643643#endif
     
    645645        if (!bootdev[0]) {
    646646            mr_free(bootdev);
    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 ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    649649            if (strstr(bootdev, "/dev/cciss/")) {
    650650                mr_free(bootdev);
    651                 mr_asprintf(&bootdev, "%s", call_program_and_get_last_line_of_output
     651                mr_asprintf(bootdev, "%s", call_program_and_get_last_line_of_output
    652652                       ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | cut -dp -f1"));
    653653            }
     
    660660            ch = 'U';
    661661        if (bkpinfo->boot_loader != '\0') {
    662             mr_asprintf(&tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
     662            mr_asprintf(tmp, "User specified boot loader. It is '%c'.", bkpinfo->boot_loader);
    663663            log_msg(2, tmp);
    664664            mr_free(tmp);
     
    667667        }
    668668        if (bkpinfo->boot_device[0] != '\0') {
    669             mr_asprintf(&tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
     669            mr_asprintf(tmp, "User specified boot device. It is '%s'.", bkpinfo->boot_device);
    670670            log_msg(2, tmp);
    671671            mr_free(tmp);
     
    690690    }
    691691    if (bkpinfo->boot_loader == 'L') {
    692         mr_asprintf(&bootldr_str, "LILO");
     692        mr_asprintf(bootldr_str, "LILO");
    693693        if (!does_file_exist("/etc/lilo.conf")) {
    694694            fatal_error
     
    696696        }
    697697    } else if (bkpinfo->boot_loader == 'G') {
    698         mr_asprintf(&bootldr_str, "GRUB");
     698        mr_asprintf(bootldr_str, "GRUB");
    699699        if (!does_file_exist("/boot/grub/menu.lst")
    700700            && does_file_exist("/boot/grub/grub.conf")) {
     
    706706                ("The de facto standard location for your boot loader's config file is /boot/grub/menu.lst, /boot/grub/grub.cfg, or /boot/grub2/grub.cfg but I cannot find it there. What is wrong with your Linux distribution?");
    707707        }
    708         mr_asprintf(&bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));
     708        mr_asprintf(bootldr_ver, "%s", call_program_and_get_last_line_of_output("grub --version"));
    709709    } else if (bkpinfo->boot_loader == 'E') {
    710         mr_asprintf(&bootldr_str, "ELILO");
     710        mr_asprintf(bootldr_str, "ELILO");
    711711        /* BCO: fix it for Debian, Mandrake, ... */
    712712        if (!does_file_exist("/etc/elilo.conf")
     
    739739        }
    740740    } else if (bkpinfo->boot_loader == 'R') {
    741         mr_asprintf(&bootldr_str, "RAW");
     741        mr_asprintf(bootldr_str, "RAW");
    742742    }
    743743#ifdef __FreeBSD__
    744744    else if (bkpinfo->boot_loader == 'D') {
    745         mr_asprintf(&bootldr_str, "DD");
     745        mr_asprintf(bootldr_str, "DD");
    746746    }
    747747
    748748    else if (bkpinfo->boot_loader == 'B') {
    749         mr_asprintf(&bootldr_str, "BOOT0");
     749        mr_asprintf(bootldr_str, "BOOT0");
    750750    }
    751751#endif
    752752    else {
    753         mr_asprintf(&bootldr_str, "unknown");
    754     }
    755     mr_asprintf(&tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
     753        mr_asprintf(bootldr_str, "unknown");
     754    }
     755    mr_asprintf(tmp, "Your boot loader is %s and it boots from %s", bootldr_str, bkpinfo->boot_device);
    756756    log_to_screen(tmp);
    757757    mr_free(tmp);
    758758    if (bootldr_ver != NULL) {
    759         mr_asprintf(&tmp, "Boot loader version string: %s", bootldr_ver);
     759        mr_asprintf(tmp, "Boot loader version string: %s", bootldr_ver);
    760760        log_to_screen(tmp);
    761761        mr_free(tmp);
    762762    }
    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 netfs:
    790         mr_asprintf(&value, "netfs");
     790        mr_asprintf(value, "netfs");
    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/BOOTLOADER.VER", bkpinfo->tmpdir);
     825    mr_asprintf(tmp, "%s/BOOTLOADER.VER", bkpinfo->tmpdir);
    826826    if (write_one_liner_data_file(tmp, bootldr_ver)) {
    827827        res++;
     
    832832    mr_free(tmp);
    833833
    834     mr_asprintf(&tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
     834    mr_asprintf(tmp, "%s/DIFFERENTIAL", bkpinfo->tmpdir);
    835835    if (bkpinfo->differential) {
    836836        res += write_one_liner_data_file(tmp, "1");
     
    841841
    842842    if (g_getfattr) {
    843         mr_asprintf(&tmp1, "%s/XATTR", bkpinfo->tmpdir);
     843        mr_asprintf(tmp1, "%s/XATTR", bkpinfo->tmpdir);
    844844        if (write_one_liner_data_file(tmp1, "TRUE")) {
    845845            log_msg(1, "%ld: Unable to write one-liner XATTR",
     
    849849    }
    850850    if (g_getfacl) {
    851         mr_asprintf(&tmp1, "%s/ACL", bkpinfo->tmpdir);
     851        mr_asprintf(tmp1, "%s/ACL", bkpinfo->tmpdir);
    852852        if (write_one_liner_data_file(tmp1, "TRUE")) {
    853853            log_msg(1, "%ld: Unable to write one-liner ACL",
     
    857857    }
    858858    if (bkpinfo->use_obdr) {
    859         mr_asprintf(&tmp1, "%s/OBDR", bkpinfo->tmpdir);
     859        mr_asprintf(tmp1, "%s/OBDR", bkpinfo->tmpdir);
    860860        if (write_one_liner_data_file(tmp1, "TRUE")) {
    861861            log_msg(1, "%ld: Unable to write one-liner OBDR",
     
    868868        size_of_all_biggiefiles_K(bkpinfo) / bkpinfo->optimal_set_size + 1;
    869869    /* add netfs stuff here? */
    870     mr_asprintf(&command, "mkdir -p %s/images", bkpinfo->scratchdir);
     870    mr_asprintf(command, "mkdir -p %s/images", bkpinfo->scratchdir);
    871871    if (system(command)) {
    872872        res++;
     
    8808806=\"%s\" 7=%ld 8=\"%s\" 9=\"%s\" 10=\"%s\" \
    88188111=\"%s\" 12=%s 13=%ld 14=\"%s\" 15=\"%s\" 16=\"%s\" 17=\"%s\" 18=%ld 19=%d",*/
    882     mr_asprintf(&command, "mindi %s --custom %s %s/images '%s' '%s' \
     882    mr_asprintf(command, "mindi %s --custom %s %s/images '%s' '%s' \
    883883'%s' %ld '%s' '%s' '%s' \
    884884'%s' %s %ld '%s' '%s' '%s' '%s' %ld %d '%s'", tmp2, bkpinfo->tmpdir,    // parameter #2
     
    929929    if (!res) {
    930930        log_to_screen("Boot+data disks were created OK");
    931         mr_asprintf(&command, "cp -f %s/images/mindi.iso %s/mondorescue.iso",
     931        mr_asprintf(command, "cp -f %s/images/mindi.iso %s/mondorescue.iso",
    932932                bkpinfo->scratchdir, MINDI_CACHE);
    933933        log_msg(2, command);
     
    936936
    937937        if (bkpinfo->nonbootable_backup) {
    938             mr_asprintf(&command, "cp -f %s/all.tar.gz %s/images",
     938            mr_asprintf(command, "cp -f %s/all.tar.gz %s/images",
    939939                    bkpinfo->tmpdir, bkpinfo->scratchdir);
    940940            if (system(command)) {
     
    946946        /* For USB we already have everything on the key */
    947947        if (bkpinfo->backup_media_type == usb) {
    948             mr_asprintf(&command, "rm -rf %s/images", bkpinfo->scratchdir);
     948            mr_asprintf(command, "rm -rf %s/images", bkpinfo->scratchdir);
    949949            run_program_and_log_output(command, FALSE);
    950950            paranoid_free(command);
    951951        } else {
    952             mr_asprintf(&tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir,
     952            mr_asprintf(tmp, "cp -f %s/images/all.tar.gz %s", bkpinfo->scratchdir,
    953953                bkpinfo->tmpdir);
    954954            if (system(tmp)) {
     
    964964    } else {
    965965        log_to_screen("Mindi failed to create your boot+data disks.");
    966         mr_asprintf(&command, "grep 'Fatal error' /var/log/mindi.log");
    967         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     966        mr_asprintf(command, "grep 'Fatal error' /var/log/mindi.log");
     967        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    968968        paranoid_free(command);
    969969
     
    14701470                    sleep(5);
    14711471                }
    1472                 mr_asprintf(&media_usage_comment, "%s", percent_media_full_comment());
     1472                mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    14731473                /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
    14741474                if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
     
    15131513                mr_free(media_usage_comment);
    15141514                if (res) {
    1515                     mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n",
     1515                    mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n",
    15161516                        storing_set_no);
    15171517                    log_to_screen(tmp);
     
    15261526    close_progress_form();
    15271527
    1528     mr_asprintf(&tmp, "Your regular files have been archived ");
     1528    mr_asprintf(tmp, "Your regular files have been archived ");
    15291529    log_msg(2, "Joining background threads to foreground thread");
    15301530    for (i = 0; i < noof_threads; i++) {
     
    15961596    log_msg(2, "make_usb_fs --- scratchdir=%s", bkpinfo->scratchdir);
    15971597    tmp1 = getcwd(old_pwd, MAX_STR_LEN - 1);
    1598     mr_asprintf(&tmp, "chmod 700 %s", bkpinfo->scratchdir);
     1598    mr_asprintf(tmp, "chmod 700 %s", bkpinfo->scratchdir);
    15991599    run_program_and_log_output(tmp, FALSE);
    16001600    paranoid_free(tmp);
     
    16041604
    16051605    mds = media_descriptor_string(bkpinfo->backup_media_type);
    1606     mr_asprintf(&message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
     1606    mr_asprintf(message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
    16071607    mr_free(mds);
    16081608    log_msg(1, message_to_screen);
    16091609
    1610     mr_asprintf(&tmp1, "%s1", bkpinfo->media_device);
     1610    mr_asprintf(tmp1, "%s1", bkpinfo->media_device);
    16111611    if (is_this_device_mounted(tmp1)) {
    16121612        log_msg(1, "USB device mounted. Remounting it at the right place");
    1613         mr_asprintf(&tmp, "umount %s", tmp1);
     1613        mr_asprintf(tmp, "umount %s", tmp1);
    16141614        run_program_and_log_output(tmp, FALSE);
    16151615        paranoid_free(tmp);
     
    16181618
    16191619    log_msg(1, "Mounting USB device.");
    1620     mr_asprintf(&tmp1, "%s/usb", bkpinfo->tmpdir);
    1621     mr_asprintf(&tmp, "mkdir -p %s", tmp1);
     1620    mr_asprintf(tmp1, "%s/usb", bkpinfo->tmpdir);
     1621    mr_asprintf(tmp, "mkdir -p %s", tmp1);
    16221622    run_program_and_log_output(tmp, FALSE);
    16231623    paranoid_free(tmp);
    16241624
    16251625    /* Mindi always create one single parition on the USB dev */
    1626     mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
     1626    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, tmp1);
    16271627    run_program_and_log_output(tmp, FALSE);
    16281628    paranoid_free(tmp);
     
    16341634
    16351635        /* Command to execute */
    1636         mr_asprintf(&tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
     1636        mr_asprintf(tmp,"mv %s/* %s", bkpinfo->scratchdir, tmp1);
    16371637        res = eval_call_to_make_USB(tmp, message_to_screen);
    16381638        if (res) {
    1639             mr_asprintf(&result_sz, "%s ...failed",tmp);
     1639            mr_asprintf(result_sz, "%s ...failed",tmp);
    16401640        } else {
    1641             mr_asprintf(&result_sz, "%s ...OK",tmp);
     1641            mr_asprintf(result_sz, "%s ...OK",tmp);
    16421642        }
    16431643        log_to_screen(result_sz);
     
    16471647
    16481648        /* Recreate the required structure under the scratch dir */
    1649         mr_asprintf(&tmp,"mkdir %s/archive", bkpinfo->scratchdir);
     1649        mr_asprintf(tmp,"mkdir %s/archive", bkpinfo->scratchdir);
    16501650        run_program_and_log_output(tmp, FALSE);
    16511651        paranoid_free(tmp);
     
    16551655
    16561656    if (is_this_device_mounted(bkpinfo->media_device)) {
    1657         mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     1657        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    16581658        run_program_and_log_output(tmp, FALSE);
    16591659        paranoid_free(tmp);
     
    17441744
    17451745    if (bkpinfo->call_before_iso[0] != '\0') {
    1746         mr_asprintf(&message_to_screen, "Running pre-ISO call for CD#%d",
     1746        mr_asprintf(message_to_screen, "Running pre-ISO call for CD#%d",
    17471747                g_current_media_number);
    17481748        res =
     
    17651765        sprintf(tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    17661766        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1767         mr_asprintf(&message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
     1767        mr_asprintf(message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
    17681768        mr_free(mds);
    17691769
     
    18101810                }
    18111811                pause_for_N_seconds(5, "Letting DVD drive settle");
    1812                 mr_asprintf(&sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
     1812                mr_asprintf(sz_blank_disk, "dvd+rw-format -force %s", bkpinfo->media_device);
    18131813                log_msg(3, "sz_blank_disk = '%s'", sz_blank_disk);
    18141814                res =
     
    18641864    } else {
    18651865        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1866         mr_asprintf(&message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
     1866        mr_asprintf(message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
    18671867        log_msg(1, message_to_screen);
    1868         mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
     1868        mr_asprintf(result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
    18691869        mr_free(mds);
    18701870        if (find_home_of_exe("genisoimage")) {
    1871             mr_asprintf(&isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);
     1871            mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);
    18721872        } else {
    1873             mr_asprintf(&isofs_cmd, "%s", MONDO_MKISOFS_CMD);
     1873            mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD);
    18741874        }
    18751875        if (bkpinfo->nonbootable_backup) {
    18761876            log_msg(1, "Making nonbootable backup");
    1877             mr_asprintf(&full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
     1877            mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
    18781878            res = eval_call_to_make_ISO(full_isofs_cmd,
    18791879                                      destfile, g_current_media_number,
     
    18941894#ifdef __IA64__
    18951895                log_msg(1, "IA64 --> elilo");
    1896                 mr_asprintf(&full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);
     1896                mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_ELILO);
    18971897                res = eval_call_to_make_ISO(full_isofs_cmd,
    18981898                                            destfile,
     
    19031903#else
    19041904                log_msg(1, "Non-ia64 --> lilo");
    1905                 mr_asprintf(&full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
     1905                mr_asprintf(full_isofs_cmd, "%s%s-b images/mindi-bootroot.2880.img -c boot.cat -o '_ISO_' -J -V _CD#_ .",isofs_cmd,MONDO_MKISOFS);
    19061906                res =
    19071907                    // FIXME: fixed boot size probably wrong. lilo to be removed
     
    19151915                log_msg(1, "make_cd_use_lilo = FALSE");
    19161916                log_msg(1, "Isolinux");
    1917                 mr_asprintf(&full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX);
     1917                mr_asprintf(full_isofs_cmd, "%s%s-o '_ISO_' -V _CD#_ .",isofs_cmd,MONDO_MKISOFS_REGULAR_SYSLINUX);
    19181918                res =
    19191919                    eval_call_to_make_ISO(full_isofs_cmd,
     
    19511951        log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);
    19521952        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1953         mr_asprintf(&message_to_screen, "Burning %s #%d", mds, g_current_media_number);
     1953        mr_asprintf(message_to_screen, "Burning %s #%d", mds, g_current_media_number);
    19541954        mr_free(mds);
    19551955        pause_and_ask_for_cdr(2, &cd_is_mountable);
     
    19711971    if (bkpinfo->call_after_iso[0] != '\0') {
    19721972        mds = media_descriptor_string(bkpinfo->backup_media_type);
    1973         mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
     1973        mr_asprintf(message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
    19741974        mr_free(mds);
    19751975        res =
     
    20072007    bool ret = TRUE;
    20082008
    2009     mr_asprintf(&command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
     2009    mr_asprintf(command, "dd if=%s bs=512 count=1 2> /dev/null | strings | head -n1", bigfile_fname);
    20102010    log_msg(1, "command = '%s'", command);
    2011     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     2011    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    20122012    mr_free(command);
    20132013
     
    20832083        return (0);
    20842084    }
    2085     mr_asprintf(&tmp, "I am now backing up all large files.");
     2085    mr_asprintf(tmp, "I am now backing up all large files.");
    20862086    log_to_screen(tmp);
    20872087    noof_biggie_files = count_lines_in_file(biggielist_fname);
     
    21272127                        "Calling ntfsclone in background because %s is an NTFS partition",
    21282128                        bigfile_fname);
    2129                 mr_asprintf(&sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,
     2129                mr_asprintf(sz_devfile, "%s/%d.%d.000", bkpinfo->tmpdir,
    21302130                        (int) (random() % 32768),
    21312131                        (int) (random() % 32768));
     
    21862186                p = bigfile_fname;
    21872187            }
    2188             mr_asprintf(&tmp, "Archiving %s ... ", bigfile_fname);
     2188            mr_asprintf(tmp, "Archiving %s ... ", bigfile_fname);
    21892189            if (res) {
    21902190                mr_strcat(tmp, "Failed!");
     
    22472247    for (;;) {
    22482248        /* backup this set of files */
    2249         mr_asprintf(&curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2249        mr_asprintf(curr_filelist_fname, FILELIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22502250        if (! does_file_exist(curr_filelist_fname)) {
    22512251            mr_free(curr_filelist_fname);
     
    22532253        }
    22542254
    2255         mr_asprintf(&curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
     2255        mr_asprintf(curr_afioball_fname, AFIOBALL_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no, bkpinfo->zip_suffix);
    22562256
    22572257        log_msg(1, "EXAT'g set %ld", curr_set_no);
    22582258        if (g_getfattr) {
    2259             mr_asprintf(&curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2259            mr_asprintf(curr_xattr_list_fname, XATTR_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22602260            get_fattr_list(curr_filelist_fname, curr_xattr_list_fname);
    22612261        }
    22622262        if (g_getfacl) {
    2263             mr_asprintf(&curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
     2263            mr_asprintf(curr_acl_list_fname, ACL_LIST_FNAME_RAW_SZ, bkpinfo->tmpdir, curr_set_no);
    22642264            get_acl_list(curr_filelist_fname, curr_acl_list_fname);
    22652265        }
     
    22712271        retval += res;
    22722272        if (res) {
    2273             mr_asprintf(&tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
     2273            mr_asprintf(tmp, "Errors occurred while archiving set %ld. Perhaps your live filesystem changed?", curr_set_no);
    22742274            log_to_screen(tmp);
    22752275            mr_free(tmp);
    22762276        }
    22772277
    2278         mr_asprintf(&media_usage_comment, "%s", percent_media_full_comment());
     2278        mr_asprintf(media_usage_comment, "%s", percent_media_full_comment());
    22792279
    22802280        /* copy to CD (scratchdir) ... and an actual CD-R if necessary */
     
    23232323
    23242324        if (res) {
    2325             mr_asprintf(&tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
     2325            mr_asprintf(tmp, "Failed to add archive %ld's files to CD dir\n", curr_set_no);
    23262326            log_to_screen(tmp);
    23272327            mr_free(tmp);
     
    23342334    }
    23352335    close_progress_form();
    2336     mr_asprintf(&tmp, "Your regular files have been archived ");
     2336    mr_asprintf(tmp, "Your regular files have been archived ");
    23372337    if (retval) {
    23382338        mr_strcat(tmp, "(with errors).");
     
    24202420    mvaddstr_and_log_it(g_currentY, 0,
    24212421                        "Archiving large files to media           ");
    2422     mr_asprintf(&biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
     2422    mr_asprintf(biggielist, "%s/archives/biggielist.txt", bkpinfo->scratchdir);
    24232423    if (g_getfattr) {
    2424         mr_asprintf(&xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2424        mr_asprintf(xattr_fname, XATTR_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    24252425    }
    24262426    if (g_getfacl) {
    2427         mr_asprintf(&acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
    2428     }
    2429 
    2430     mr_asprintf(&command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
     2427        mr_asprintf(acl_fname, ACL_BIGGLST_FNAME_RAW_SZ, bkpinfo->tmpdir);
     2428    }
     2429
     2430    mr_asprintf(command, "cp %s/biggielist.txt %s", bkpinfo->tmpdir,
    24312431            biggielist);
    24322432    paranoid_system(command);
    24332433    mr_free(command);
    24342434
    2435     mr_asprintf(&blah, "biggielist = %s", biggielist);
     2435    mr_asprintf(blah, "biggielist = %s", biggielist);
    24362436    log_msg(2, blah);
    24372437    mr_free(blah);
     
    24432443    if (g_getfattr) {
    24442444        get_fattr_list(biggielist, xattr_fname);
    2445         mr_asprintf(&command, "cp %s %s/archives/", xattr_fname,
     2445        mr_asprintf(command, "cp %s %s/archives/", xattr_fname,
    24462446            bkpinfo->scratchdir);
    24472447        paranoid_system(command);
     
    24502450    if (g_getfacl) {
    24512451        get_acl_list(biggielist, acl_fname);
    2452         mr_asprintf(&command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
     2452        mr_asprintf(command, "cp %s %s/archives/", acl_fname, bkpinfo->scratchdir);
    24532453        paranoid_system(command);
    24542454        mr_free(command);
     
    24572457    if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    24582458        res += write_EXAT_files_to_tape(xattr_fname, acl_fname);
    2459         mr_asprintf(&blah, "%ld", count_lines_in_file(biggielist));
     2459        mr_asprintf(blah, "%ld", count_lines_in_file(biggielist));
    24602460        write_header_block_to_stream((off_t)0, blah, BLK_START_BIGGIEFILES);
    24612461        mr_free(blah);
     
    25332533            continue;
    25342534        }
    2535         mr_asprintf(&curr_file, "%s", cf);
     2535        mr_asprintf(curr_file, "%s", cf);
    25362536        if (!does_file_exist(curr_file)) {
    25372537            log_msg(1,
     
    25622562            continue;
    25632563        }
    2564         mr_asprintf(&curr_file, "%s", cf);
    2565 
    2566         mr_asprintf(&tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
     2564        mr_asprintf(curr_file, "%s", cf);
     2565
     2566        mr_asprintf(tmp, "mv -f %s %s/archives/", curr_file, bkpinfo->scratchdir);
    25672567        mr_free(curr_file);
    25682568        res = run_program_and_log_output(tmp, 5);
     
    26362636            continue;
    26372637        }
    2638         mr_asprintf(&curr_file, "%s", cf);
     2638        mr_asprintf(curr_file, "%s", cf);
    26392639        if (!does_file_exist(curr_file)) {
    26402640            log_msg(1,
     
    26872687    char *cdrecord = NULL;
    26882688
    2689     mr_asprintf(&bkp, "%s", cdrw_dev);
     2689    mr_asprintf(bkp, "%s", cdrw_dev);
    26902690    if (find_cdrw_device(cdrw_dev)) {
    26912691        strcpy(cdrw_dev, bkp);
    26922692    } else {
    26932693        if (!system("which cdrecord > /dev/null 2> /dev/null")) {
    2694             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2694            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26952695        } else if (!system("which dvdrecord > /dev/null 2> /dev/null")) {
    2696             mr_asprintf(&cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
     2696            mr_asprintf(cdrecord, "cdrecord dev=%s -atip", cdrw_dev);
    26972697        } else {
    26982698            log_msg(2, "Oh well. I guess I'll just pray then.");
     
    27532753
    27542754    mds = media_descriptor_string(g_backup_media_type);
    2755     mr_asprintf(&tmp, "I am about to burn %s #%d", mds, g_current_media_number);
     2755    mr_asprintf(tmp, "I am about to burn %s #%d", mds, g_current_media_number);
    27562756    mr_free(mds);
    27572757    log_to_screen(tmp);
     
    27712771      retract_CD_tray_and_defeat_autorun();
    27722772*/
    2773         mr_asprintf(&tmp, "umount %s", cdrom_dev);
     2773        mr_asprintf(tmp, "umount %s", cdrom_dev);
    27742774        run_program_and_log_output(tmp, 1);
    27752775        sprintf(szcdno, "%s/archives/THIS-CD-NUMBER", mtpt);
     
    27772777        sprintf(szunmount, "umount %s", mtpt);
    27782778        cd_number = -1;
    2779         mr_asprintf(&tmp, "mount %s %s", cdrom_dev, mtpt);
    2780         mr_asprintf(&our_serial_str, "%s", "");
     2779        mr_asprintf(tmp, "mount %s %s", cdrom_dev, mtpt);
     2780        mr_asprintf(our_serial_str, "%s", "");
    27812781        attempt_to_mount_returned_this = run_program_and_log_output(tmp, 1);
    27822782        mr_free(tmp);
     
    28072807
    28082808            cd_number = atoi(last_line_of_file(szcdno));
    2809             mr_asprintf(&tmp, "cat %s 2> /dev/null", szserfname);
     2809            mr_asprintf(tmp, "cat %s 2> /dev/null", szserfname);
    28102810            mr_free(our_serial_str);
    2811             mr_asprintf(&our_serial_str, "%s",
     2811            mr_asprintf(our_serial_str, "%s",
    28122812                   call_program_and_get_last_line_of_output(tmp));
    28132813            mr_free(tmp);
     
    28492849        }
    28502850        mds = media_descriptor_string(g_backup_media_type);
    2851         mr_asprintf(&tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
     2851        mr_asprintf(tmp, "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    28522852                mds, g_current_media_number, mds);
    28532853        mr_free(mds);
     
    29942994    if (is_this_file_compressed(biggie_filename)
    29952995        || bkpinfo->compression_level == 0) {
    2996         mr_asprintf(&suffix, "%s", "");
     2996        mr_asprintf(suffix, "%s", "");
    29972997        //      log_it("%s is indeed compressed :-)", filename);
    29982998        should_I_compress_slices = FALSE;
    29992999    } else {
    3000         mr_asprintf(&suffix, "%s", bkpinfo->zip_suffix);
     3000        mr_asprintf(suffix, "%s", bkpinfo->zip_suffix);
    30013001        should_I_compress_slices = TRUE;
    30023002    }
     
    30143014            fatal_error("ntfsresize not found");
    30153015        }
    3016         mr_asprintf(&command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
     3016        mr_asprintf(command, "ntfsresize --force --info %s|grep '^You might resize at '|cut -d' ' -f5", biggie_filename);
    30173017        log_it("command = %s", command);
    3018         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     3018        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    30193019        mr_free(command);
    30203020        log_it("res of it = %s", tmp);
     
    30243024        file_to_openin = biggie_filename;
    30253025        if (strchr(biggie_filename,'\'') != NULL) {
    3026             mr_asprintf(&command, "md5sum \"%s\"", biggie_filename);
     3026            mr_asprintf(command, "md5sum \"%s\"", biggie_filename);
    30273027        } else {
    3028             mr_asprintf(&command, "md5sum '%s'", biggie_filename);
     3028            mr_asprintf(command, "md5sum '%s'", biggie_filename);
    30293029        }
    30303030        if (!(fin = popen(command, "r"))) {
     
    30493049    strcpy(biggiestruct.checksum, checksum_line);
    30503050
    3051     mr_asprintf(&tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
     3051    mr_asprintf(tmp, "%s", slice_fname(biggie_file_number, 0, bkpinfo->tmpdir, ""));
    30523052    fout = fopen(tmp, "w");
    30533053    if (fout == NULL) {
     
    30673067    if (!(fin = fopen(file_to_openin, "r"))) {
    30683068        log_OS_error("Unable to openin biggie_filename");
    3069         mr_asprintf(&tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
     3069        mr_asprintf(tmp, "Cannot archive bigfile '%s': not found", biggie_filename);
    30703070        log_to_screen(tmp);
    30713071        paranoid_free(tmp);
     
    30893089    }
    30903090    for (slice_num = 1; !finished; slice_num++) {
    3091         mr_asprintf(&curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
    3092         mr_asprintf(&curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
    3093 
    3094         mr_asprintf(&tmp, "%s", percent_media_full_comment());
     3091        mr_asprintf(curr_slice_fname_uncompressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, ""));
     3092        mr_asprintf(curr_slice_fname_compressed, "%s", slice_fname(biggie_file_number, slice_num, bkpinfo->tmpdir, suffix));
     3093
     3094        mr_asprintf(tmp, "%s", percent_media_full_comment());
    30953095        update_progress_form(tmp);
    30963096        paranoid_free(tmp);
     
    31243124            }
    31253125            if (should_I_compress_slices && bkpinfo->compression_level > 0) {
    3126                 mr_asprintf(&command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
     3126                mr_asprintf(command, "%s -%d %s", bkpinfo->zip_exe, bkpinfo->compression_level, curr_slice_fname_uncompressed);
    31273127                log_msg(2, command);
    31283128                if ((res = system(command))) {
     
    31313131                //          did_I_compress_slice = TRUE;
    31323132            } else {
    3133                 mr_asprintf(&command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
     3133                mr_asprintf(command, "mv %s %s 2>> %s", curr_slice_fname_uncompressed, curr_slice_fname_compressed, MONDO_LOGFILE);
    31343134                res = 0;        // don't do it :)
    31353135                //          did_I_compress_slice = FALSE;
     
    31473147            }
    31483148            if (res) {
    3149                 mr_asprintf(&tmp, "Problem with slice # %ld", slice_num);
     3149                mr_asprintf(tmp, "Problem with slice # %ld", slice_num);
    31503150            } else {
    3151                 mr_asprintf(&tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1,
     3151                mr_asprintf(tmp, "%s - Bigfile #%ld, slice #%ld compressed OK          ", biggie_filename, biggie_file_number + 1,
    31523152                        slice_num);
    31533153            }
     
    31643164            paranoid_free(tmp);
    31653165
    3166             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_compressed);
     3166            mr_asprintf(file_to_archive, "%s", curr_slice_fname_compressed);
    31673167            g_current_progress++;
    31683168        } else {                /* if i==0 then ... */
    31693169
    31703170            finished = TRUE;
    3171             mr_asprintf(&file_to_archive, "%s", curr_slice_fname_uncompressed);
     3171            mr_asprintf(file_to_archive, "%s", curr_slice_fname_uncompressed);
    31723172            if (IS_THIS_A_STREAMING_BACKUP(bkpinfo->backup_media_type)) {
    31733173                break;
     
    31903190        retval += res;
    31913191        if (res) {
    3192             mr_asprintf(&tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
     3192            mr_asprintf(tmp, "Failed to add slice %ld of bigfile %ld to scratchdir", slice_num, biggie_file_number + 1);
    31933193            log_to_screen(tmp);
    31943194            paranoid_free(tmp);
     
    32003200    mr_free(suffix);
    32013201    paranoid_fclose(fin);
    3202     mr_asprintf(&tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
     3202    mr_asprintf(tmp, "Sliced bigfile #%ld", biggie_file_number + 1);
    32033203    if (retval) {
    32043204        mr_strcat(tmp, "...FAILED");
     
    32343234    assert_string_is_neither_NULL_nor_zerolength(d);
    32353235
    3236     mr_asprintf(&dir, "%s/archives", d);
    3237     mr_asprintf(&tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
     3236    mr_asprintf(dir, "%s/archives", d);
     3237    mr_asprintf(tmp, "find %s -name '*.afio*' -exec rm -f '{}' \\;", dir);
    32383238    run_program_and_log_output(tmp, FALSE);
    32393239    mr_free(tmp);
    3240     mr_asprintf(&tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
     3240    mr_asprintf(tmp, "find %s -name '*list.[0-9]*' -exec rm -f '{}' \\;", dir);
    32413241    run_program_and_log_output(tmp, FALSE);
    32423242    mr_free(tmp);
    3243     mr_asprintf(&tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
     3243    mr_asprintf(tmp, "find %s -name 'slice*' -exec rm -f '{}' \\;", dir);
    32443244    run_program_and_log_output(tmp, FALSE);
    32453245    mr_free(tmp);
    3246     mr_asprintf(&tmp, "rm -f %s/cklist*", dir);
     3246    mr_asprintf(tmp, "rm -f %s/cklist*", dir);
    32473247    run_program_and_log_output(tmp, FALSE);
    32483248    mr_free(tmp);
    3249     mr_asprintf(&tmp, "rm -f %s/zero", dir);
     3249    mr_asprintf(tmp, "rm -f %s/zero", dir);
    32503250    run_program_and_log_output(tmp, FALSE);
    32513251    mr_free(tmp);
    32523252    log_msg(1, "Wiped %s's archives", dir);
    3253     mr_asprintf(&tmp, "ls -l %s", dir);
     3253    mr_asprintf(tmp, "ls -l %s", dir);
    32543254    mr_free(dir);
    32553255    run_program_and_log_output(tmp, FALSE);
     
    35073507        log_msg(2,
    35083508                "Not verifying again. Per-CD/ISO verification already carried out.");
    3509         mr_asprintf(&tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
     3509        mr_asprintf(tmp, "cat %s/changed.files > %s/changed.files 2> /dev/null",bkpinfo->tmpdir, MONDO_CACHE);
    35103510        paranoid_system(tmp);
    35113511        mr_free(tmp);
     
    35323532            if (res) {
    35333533                mds = media_descriptor_string(bkpinfo->backup_media_type);
    3534                 mr_asprintf(&tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3534                mr_asprintf(tmp, "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
    35353535                mr_free(mds);
    35363536                log_to_screen(tmp);
     
    35393539            }
    35403540        }
    3541         mr_asprintf(&tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3541        mr_asprintf(tmp, "grep 'afio: ' %s | sed 's/afio: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35423542        res = system(tmp);
    35433543        mr_free(tmp);
    35443544
    3545         mr_asprintf(&tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
     3545        mr_asprintf(tmp, "grep 'star: ' %s | sed 's/star: //' | grep -vE '^/dev/.*$' >> %s/changed.files", MONDO_LOGFILE, MONDO_CACHE);
    35463546        res = system(tmp);
    35473547        mr_free(tmp);
     
    35523552        }
    35533553    }
    3554     mr_asprintf(&tmp, "%s/changed.files", MONDO_CACHE);
     3554    mr_asprintf(tmp, "%s/changed.files", MONDO_CACHE);
    35553555    diffs = count_lines_in_file(tmp);
    35563556    mr_free(tmp);
  • branches/3.0/mondo/src/common/libmondo-cli.c

    r3154 r3185  
    9797    for (i = 0; i < 128; i++) {
    9898        if (flag_set[i]) {
    99             mr_asprintf(&tmp, "-%c %s", i, flag_val[i]);
     99            mr_asprintf(tmp, "-%c %s", i, flag_val[i]);
    100100            log_msg(3, tmp);
    101101            mr_free(tmp);
     
    246246        }
    247247
    248         mr_asprintf(&tmp1, "%s", flag_val['I']);
     248        mr_asprintf(tmp1, "%s", flag_val['I']);
    249249        p = tmp1;
    250250        q = tmp1;
     
    448448        if (p == NULL) {
    449449            /* protocol not found assuming NFS for compatibility */
    450             mr_asprintf(&q,"nfs");
     450            mr_asprintf(q,"nfs");
    451451
    452452            p = strchr(bkpinfo->netfs_mount, ':');
     
    460460            /* Isolate the protocol */
    461461            *p = '\0';
    462             mr_asprintf(&q,"%s",bkpinfo->netfs_mount);
     462            mr_asprintf(q,"%s",bkpinfo->netfs_mount);
    463463
    464464            /* Skip proto now */
     
    484484            p--;
    485485            *p = '\0';
    486             mr_asprintf(&q,"%s",bkpinfo->netfs_mount);
     486            mr_asprintf(q,"%s",bkpinfo->netfs_mount);
    487487            bkpinfo->netfs_user = q;
    488488            strcpy(bkpinfo->netfs_mount,tmp);
     
    578578    if (flag_set['z']) {
    579579        if (find_home_of_exe("getfattr")) {
    580             mr_asprintf(&g_getfattr,"getfattr");
     580            mr_asprintf(g_getfattr,"getfattr");
    581581        }
    582582        if (find_home_of_exe("getfacl")) {
    583             mr_asprintf(&g_getfacl,"getfacl");
     583            mr_asprintf(g_getfacl,"getfacl");
    584584        }
    585585    }
     
    595595            log_to_screen("Please supply a sensible value with '-E'\n");
    596596        }
    597         mr_asprintf(&tmp1, "%s", flag_val['E']);
     597        mr_asprintf(tmp1, "%s", flag_val['E']);
    598598
    599599        p = tmp1;
     
    656656
    657657    if (flag_set['b']) {
    658         mr_asprintf(&psz, "%s", flag_val['b']);
     658        mr_asprintf(psz, "%s", flag_val['b']);
    659659        log_msg(1, "psz = '%s'", psz);
    660660        if (psz[strlen(psz) - 1] == 'k') {
     
    730730
    731731    if ((flag_set['n']) && (! bkpinfo->restore_data)) {
    732         mr_asprintf(&tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir);
     732        mr_asprintf(tmp1,"%s/%s/.dummy.txt", bkpinfo->isodir,bkpinfo->netfs_remote_dir);
    733733        if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
    734734            sprintf(tmp, "su - %s -c \"echo hi > %s\"", bkpinfo->netfs_user, tmp1);
     
    10031003            if (flag_set[opt]) {
    10041004                bad_switches = TRUE;
    1005                 mr_asprintf(&tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
     1005                mr_asprintf(tmp, "Switch -%c previously defined as %s\n", opt, flag_val[opt]);
    10061006                log_to_screen(tmp);
    10071007                paranoid_free(tmp);
     
    10191019                        if (strchr(flag_val[opt], '/')
    10201020                            && flag_val[opt][0] != '/') {
    1021                             mr_asprintf(&tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
     1021                            mr_asprintf(tmp, "-%c flag --- must be absolute path --- '%s' isn't absolute", opt, flag_val[opt]);
    10221022                            log_to_screen(tmp);
    10231023                            paranoid_free(tmp);
     
    10321032    for (i = optind; i < argc; i++) {
    10331033        bad_switches = TRUE;
    1034         mr_asprintf(&tmp, "Invalid arg -- %s\n", argv[i]);
     1034        mr_asprintf(tmp, "Invalid arg -- %s\n", argv[i]);
    10351035        log_to_screen(tmp);
    10361036        paranoid_free(tmp);
     
    10631063    switch (sig) {
    10641064    case SIGINT:
    1065         mr_asprintf(&tmp, "SIGINT");
    1066         mr_asprintf(&tmp2, "You interrupted me :-)");
     1065        mr_asprintf(tmp, "SIGINT");
     1066        mr_asprintf(tmp2, "You interrupted me :-)");
    10671067        break;
    10681068    case SIGKILL:
    1069         mr_asprintf(&tmp, "SIGKILL");
    1070         mr_asprintf(&tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
     1069        mr_asprintf(tmp, "SIGKILL");
     1070        mr_asprintf(tmp2, "I seriously have no clue how this signal even got to me. Something's wrong with your system.");
    10711071        break;
    10721072    case SIGTERM:
    1073         mr_asprintf(&tmp, "SIGTERM");
    1074         mr_asprintf(&tmp2, "Got terminate signal");
     1073        mr_asprintf(tmp, "SIGTERM");
     1074        mr_asprintf(tmp2, "Got terminate signal");
    10751075        break;
    10761076    case SIGHUP:
    1077         mr_asprintf(&tmp, "SIGHUP");
    1078         mr_asprintf(&tmp2, "Hangup on line");
     1077        mr_asprintf(tmp, "SIGHUP");
     1078        mr_asprintf(tmp2, "Hangup on line");
    10791079        break;
    10801080    case SIGSEGV:
    1081         mr_asprintf(&tmp, "SIGSEGV");
    1082         mr_asprintf(&tmp2, "Internal programming error. Please send a backtrace as well as your log.");
     1081        mr_asprintf(tmp, "SIGSEGV");
     1082        mr_asprintf(tmp2, "Internal programming error. Please send a backtrace as well as your log.");
    10831083        break;
    10841084    case SIGPIPE:
    1085         mr_asprintf(&tmp, "SIGPIPE");
    1086         mr_asprintf(&tmp2, "Pipe was broken");
     1085        mr_asprintf(tmp, "SIGPIPE");
     1086        mr_asprintf(tmp2, "Pipe was broken");
    10871087        break;
    10881088    case SIGABRT:
    1089         mr_asprintf(&tmp, "SIGABRT");
    1090         mr_asprintf(&tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
     1089        mr_asprintf(tmp, "SIGABRT");
     1090        mr_asprintf(tmp2, "Abort - probably failed assertion. I'm sleeping for a few seconds so you can read the message.");
    10911091        break;
    10921092    default:
    1093         mr_asprintf(&tmp, "(Unknown)");
    1094         mr_asprintf(&tmp2, "(Unknown)");
     1093        mr_asprintf(tmp, "(Unknown)");
     1094        mr_asprintf(tmp2, "(Unknown)");
    10951095    }
    10961096
  • branches/3.0/mondo/src/common/libmondo-devices.c

    r3171 r3185  
    131131
    132132    malloc_string(comment);
    133     mr_asprintf(&tmp, "%s", where_is_root_mounted());
     133    mr_asprintf(tmp, "%s", where_is_root_mounted());
    134134    sprintf(comment, "root is mounted at %s\n", tmp);
    135135    log_msg(0, comment);
     
    555555    run_program_and_log_output("insmod ide-scsi", -1);
    556556    if (find_home_of_exe("cdrecord")) {
    557         mr_asprintf(&cdr_exe, "cdrecord");
     557        mr_asprintf(cdr_exe, "cdrecord");
    558558    } else {
    559         mr_asprintf(&cdr_exe, "dvdrecord");
     559        mr_asprintf(cdr_exe, "dvdrecord");
    560560    }
    561561    if (find_home_of_exe(cdr_exe)) {
     
    563563                "%s -scanbus 2> /dev/null | tr -s '\t' ' ' | grep \"[0-9]*,[0-9]*,[0-9]*\" | grep -v \"[0-9]*) \\*\" | grep -E '[D|C][V|D]' | cut -d' ' -f2 | head -n1",
    564564                cdr_exe);
    565         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     565        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    566566    }
    567567    if ((tmp == NULL) || (strlen(tmp) < 2)) {
     
    653653
    654654    if (find_home_of_exe("cdrecord")) {
    655         mr_asprintf(&cdr_exe, "cdrecord");
     655        mr_asprintf(cdr_exe, "cdrecord");
    656656    } else {
    657         mr_asprintf(&cdr_exe, "dvdrecord");
     657        mr_asprintf(cdr_exe, "dvdrecord");
    658658    }
    659659    tmp[0] = '\0';
     
    876876            cdr_exe, g_cdrw_drive_is_here);
    877877    log_msg(1, "command=%s", command);
    878     mr_asprintf(&tmp1, "%s", call_program_and_get_last_line_of_output(command));
     878    mr_asprintf(tmp1, "%s", call_program_and_get_last_line_of_output(command));
    879879    if (strlen(tmp1) > 0) {
    880880        strcpy(output, tmp1);
     
    11341134        log_msg(1, "%s needs to have a '/' prefixed - I'll do it",
    11351135                device_raw);
    1136         mr_asprintf(&tmp, "/%s", device_raw);
     1136        mr_asprintf(tmp, "/%s", device_raw);
    11371137    } else {
    1138         mr_asprintf(&tmp, "%s", device_raw);
     1138        mr_asprintf(tmp, "%s", device_raw);
    11391139    }
    11401140    log_msg(1, "Is %s mounted?", tmp);
     
    11451145        return(FALSE);
    11461146    }
    1147     mr_asprintf(&device_with_tab, "%s\t", tmp);
    1148     mr_asprintf(&device_with_space, "%s ", tmp);
     1147    mr_asprintf(device_with_tab, "%s\t", tmp);
     1148    mr_asprintf(device_with_space, "%s ", tmp);
    11491149    mr_free(tmp);
    11501150
     
    11651165    mr_free(device_with_tab);
    11661166    paranoid_pclose(fin);
    1167     mr_asprintf(&tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
     1167    mr_asprintf(tmp, "%s | grep -E \"^%s\" > /dev/null 2> /dev/null", SWAPLIST_COMMAND, device_with_space);
    11681168    mr_free(device_with_space);
    11691169    log_msg(4, "tmp (command) = '%s'", tmp);
     
    13091309    }
    13101310#ifndef __FreeBSD__
    1311     mr_asprintf(&options, "ro");
     1311    mr_asprintf(options, "ro");
    13121312#endif
    13131313
     
    13151315
    13161316#ifdef __FreeBSD__
    1317         mr_asprintf(&dev, "%s", make_vn(device));
     1317        mr_asprintf(dev, "%s", make_vn(device));
    13181318        if (!dev) {
    1319             mr_asprintf(&command, "Unable to mount ISO (make_vn(%s) failed)", device);
     1319            mr_asprintf(command, "Unable to mount ISO (make_vn(%s) failed)", device);
    13201320            fatal_error(command);
    13211321        }
     
    13321332
    13331333#ifdef __FreeBSD__
    1334     mr_asprintf(&command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
     1334    mr_asprintf(command, "mount_cd9660 -r %s %s 2>> %s", device, mountpoint, MONDO_LOGFILE);
    13351335
    13361336#else
    1337     mr_asprintf(&command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
     1337    mr_asprintf(command, "mount %s -o %s -t iso9660 %s 2>> %s", device, options, mountpoint, MONDO_LOGFILE);
    13381338    paranoid_free(options);
    13391339#endif
     
    14071407    } else if (bkpinfo->backup_media_type == iso) {
    14081408        if (bkpinfo->subdir) {
    1409             mr_asprintf(&mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);
     1409            mr_asprintf(mountdir, "%s/%s", bkpinfo->isodir, bkpinfo->subdir);
    14101410        } else {
    1411             mr_asprintf(&mountdir, "%s", bkpinfo->isodir);
     1411            mr_asprintf(mountdir, "%s", bkpinfo->isodir);
    14121412        }
    14131413#ifdef __FreeBSD__
     
    16731673    ********/
    16741674    /* Get the number of mounted file systems ((those that start with "/dev/" */
    1675     mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
     1675    mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $0}}'|wc -l");
    16761676    log_msg(5, "Running: %s", command);
    1677     mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     1677    mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    16781678    paranoid_free(command);
    16791679
     
    16831683
    16841684    for (i=mount_cnt; i > 0; i--) {
    1685         mr_asprintf(&command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
     1685        mr_asprintf(command, "mount 2>/dev/null | awk '{if($1 ~ \"^/dev/\"){print $1,$3}}'|head -n %d", i);
    16861686        log_msg(5, "Running: %s", command);
    1687         mr_asprintf(&mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
     1687        mr_asprintf(mounted_file_system, "%s", call_program_and_get_last_line_of_output(command));
    16881688        paranoid_free(command);
    16891689
     
    17701770    log_msg(4, "  %s looks like a device special file", dsf);
    17711771    /* Verify that the dsf exists */
    1772     mr_asprintf(&command, "ls -al %s 2>/dev/null | wc -l", dsf);
     1772    mr_asprintf(command, "ls -al %s 2>/dev/null | wc -l", dsf);
    17731773    log_msg(5, "  Executing: %s", command);
    1774     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1774    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    17751775    paranoid_free(command);
    17761776
     
    17961796    * Either way, it's an error.
    17971797    ********/
    1798     mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     1798    mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    17991799    log_msg(5, "Executing: %s", command);
    1800     mr_asprintf(&partition_list, "%s", call_program_and_get_last_line_of_output(command));
     1800    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
    18011801    paranoid_free(command);
    18021802    log_msg(4, "Partition list for %s: %s", dsf, partition_list);
     
    18161816            mr_free(token);
    18171817        }
    1818         mr_asprintf(&ndsf, "%s", dsf);
     1818        mr_asprintf(ndsf, "%s", dsf);
    18191819    }
    18201820    mr_free(partition_list);
     
    18621862        log_msg(4, "Processing partition: %s", partitions[i]);
    18631863        /* See if it's swap. If it is, ignore it. */
    1864         mr_asprintf(&command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
     1864        mr_asprintf(command, "parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'",
    18651865          ndsf, partitions[i]);
    18661866        log_msg(5, "  Running: %s", command);
    1867         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1867        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18681868        paranoid_free(command);
    18691869        log_msg(5, "  Return value: %s", tmp);
     
    18751875        }
    18761876        /* It's not swap. See if we can find the mount point from the mount command. */
    1877         mr_asprintf(&command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
    1878         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1877        mr_asprintf(command, "mount 2>/dev/null | awk '{if((NF>0)&&($1==\"%s\")){print $3}}'", partitions[i]);
     1878        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18791879        paranoid_free(command);
    18801880        if (strlen(tmp)) {
     
    18931893        log_msg(4, "  It's not mounted. Checking to see if it's LVM...");
    18941894        /* Check for LVM */
    1895         mr_asprintf(&command, "pvdisplay -c %s 2> /dev/null", partitions[i]);
     1895        mr_asprintf(command, "pvdisplay -c %s 2> /dev/null", partitions[i]);
    18961896        log_msg(5, "  Running: %s", command);
    1897         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1897        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    18981898        paranoid_free(command);
    18991899        if (strlen(tmp)) {
    19001900            log_msg(4, "Found an LVM partition at %s. Find the VG it's in...", partitions[i]);
    19011901            /* It's LVM: Find the VG it's in */
    1902             mr_asprintf(&command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
     1902            mr_asprintf(command, "pvdisplay -v %s 2>/dev/null|grep \"VG Name\"|awk '{print $NF}'", partitions[i]);
    19031903            log_msg(5, "  Running: %s", command);
    19041904            strcpy(VG, call_program_and_get_last_line_of_output(command));
     
    19081908                /* Found the Volume Group. Now find all of the VG's mount points */
    19091909                log_msg(4, "  Found the Volume Group. Now find all of the VG's mount points");
    1910                 mr_asprintf(&command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
     1910                mr_asprintf(command, "mount 2>/dev/null|grep -E \"/dev/mapper/%s|/dev/%s/\"|awk '{printf(\"%%s \",$3)}END{print \"\"}'", VG, VG);
    19111911                log_msg(5, "  Running: %s", command);
    1912                 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1912                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19131913                paranoid_free(command);
    19141914                log_msg(4, "  VG %s mount_list: %s", VG, mount_list);
     
    19311931                paranoid_free(mount_list);
    19321932
    1933                 mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     1933                mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    19341934                log_msg (5, "Running: %s", command);
    1935                 mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1935                mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19361936                paranoid_free(command);
    19371937                log_msg(4, "  Software raid device list: %s", mount_list);
    19381938                lastpos = 0;
    19391939                while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    1940                     mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
     1940                    mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, VG);
    19411941                    log_msg (5, "Running: %s", command);
    19421942                    paranoid_free(tmp);
    1943                     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1943                    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19441944                    paranoid_free(command);
    19451945                    log_msg(4, "Number of Software raid device: %s", tmp);
     
    19721972         ********/
    19731973        log_msg (5, "It's not swap, mounted, or LVM. See if it's used in a software raid device.");
    1974         mr_asprintf(&command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
     1974        mr_asprintf(command, "mdadm --examine %s 2>/dev/null | awk '{if($1 == \"UUID\"){print $3}}'", partitions[i]);
    19751975        log_msg(4, "  Running: %s", command);
    1976         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1976        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19771977        paranoid_free(command);
    19781978        if (!strlen(tmp)) {
     
    19831983        log_msg (5, "  UUID: %s", tmp);
    19841984        /* Get the Software raid device list */
    1985         mr_asprintf(&command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
     1985        mr_asprintf(command, "%s", "cat /proc/mdstat|grep -iv Personal|awk '{if($0~\"^.*[ ]+:\"){printf(\"/dev/%s \", $1)}}END{print \"\"}'");
    19861986        log_msg (5, "  Running: %s", command);
    1987         mr_asprintf(&mount_list, "%s", call_program_and_get_last_line_of_output(command));
     1987        mr_asprintf(mount_list, "%s", call_program_and_get_last_line_of_output(command));
    19881988        paranoid_free(command);
    19891989        log_msg(4, "  Software raid device list: %s", mount_list);
     
    19911991        lastpos = 0;
    19921992        while ((token = mr_strtok(mount_list, token_chars, &lastpos)) != NULL) {
    1993             mr_asprintf(&command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
     1993            mr_asprintf(command, "mdadm --detail %s 2>/dev/null | grep -c %s", token, tmp);
    19941994            log_msg(4, "  Running: %s", command);
    19951995            paranoid_free(tmp);
    1996             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1996            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    19971997            paranoid_free(command);
    19981998            if (!atoi(tmp)) {
     
    20882088                    mr_strcat(bkpinfo->exclude_paths,"|%s",mounted_on_dsf);
    20892089                } else {
    2090                     mr_asprintf(&(bkpinfo->exclude_paths),"%s",mounted_on_dsf);
     2090                    mr_asprintf(bkpinfo->exclude_paths,"%s",mounted_on_dsf);
    20912091                }
    20922092                if (bkpinfo->exclude_devs) {
    20932093                    mr_strcat(bkpinfo->exclude_devs,"|%s",token);
    20942094                } else {
    2095                     mr_asprintf(&(bkpinfo->exclude_devs),"%s",token);
     2095                    mr_asprintf(bkpinfo->exclude_devs,"%s",token);
    20962096                }
    20972097            }
     
    21072107                    mr_strcat(bkpinfo->exclude_paths, "|%s",not_mounted_on_dsf);
    21082108                } else {
    2109                     mr_asprintf(&(bkpinfo->exclude_paths),"%s",not_mounted_on_dsf);
     2109                    mr_asprintf(bkpinfo->exclude_paths,"%s",not_mounted_on_dsf);
    21102110                }
    21112111            }
     
    21192119    case -1:
    21202120        /*  Adds a | to ensure correct detection even at both ends */
    2121         mr_asprintf(&tmp1,"|%s",token);
    2122         mr_asprintf(&tmp2,"|%s|",token);
     2121        mr_asprintf(tmp1,"|%s",token);
     2122        mr_asprintf(tmp2,"|%s|",token);
    21232123        if (mode == 'E') {
    21242124            /*  Add the token if not already in the list */
    2125             mr_asprintf(&tmp,"|%s|",bkpinfo->exclude_paths);
     2125            mr_asprintf(tmp,"|%s|",bkpinfo->exclude_paths);
    21262126            if (strstr(tmp,tmp2) == NULL) {
    21272127                if (bkpinfo->exclude_paths) {
     
    21342134        } else {
    21352135            /*  Add the token if not already in the list */
    2136             mr_asprintf(&tmp,"|%s|",bkpinfo->include_paths);
     2136            mr_asprintf(tmp,"|%s|",bkpinfo->include_paths);
    21372137            if (strstr(tmp,tmp2) == NULL) {
    21382138                strcat(bkpinfo->include_paths,tmp1);
     
    22192219         */
    22202220#ifdef __FreeBSD__
    2221         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
     2221        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -t nonfs,msdosfs,ntfs,ntfs-3g,vmhgfs,smbfs,smb,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | grep -vE \"none|Filesystem\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
    22222222#else
    2223         mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
     2223        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output("LANGUAGE=C df -m -P -x nfs -x nfs4 -x fuse.sshfs -x fuse -x vfat -x ntfs -x ntfs-3g -x vmhgfs -x smbfs -x smb -x cifs -x afs -x gfs -x ocfs -x ocfs2 -x mvfs -x nsspool -x nssvol -x iso9660 | grep -vE \"none|Filesystem|/dev/shm\" | awk '{printf \"%s %s\\n\", $4, $6;}' | sort -nr | awk '{print $NF;}' | while read x ; do test -w $x && echo $x && break ; done"));
    22242224#endif
    22252225
    22262226        if (tmp[0] != '/') {
    2227             mr_asprintf(&sz, "%s", tmp);
     2227            mr_asprintf(sz, "%s", tmp);
    22282228            mr_free(tmp);
    2229             mr_asprintf(&tmp, "/%s", sz);
     2229            mr_asprintf(tmp, "/%s", sz);
    22302230            mr_free(sz);
    22312231        }
     
    23372337            if (bkpinfo->media_device[0]) {
    23382338                if (bkpinfo->backup_media_type == usb) {
    2339                     mr_asprintf(&tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
     2339                    mr_asprintf(tmp, "I think your %s media corresponds to %s. Is this correct?", mds, bkpinfo->media_device);
    23402340                } else {
    2341                     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);
     2341                    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);
    23422342                }
    23432343                if (!ask_me_yes_or_no(tmp)) {
     
    24052405        }
    24062406        if (bkpinfo->media_device[0]) {
    2407             mr_asprintf(&tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
     2407            mr_asprintf(tmp, "I think I've found your tape streamer at %s; am I right on the money?", bkpinfo->media_device);
    24082408            if (!ask_me_yes_or_no(tmp)) {
    24092409                bkpinfo->media_device[0] = '\0';
     
    24202420            }
    24212421        }
    2422         mr_asprintf(&tmp, "ls -l %s", bkpinfo->media_device);
     2422        mr_asprintf(tmp, "ls -l %s", bkpinfo->media_device);
    24232423        if (run_program_and_log_output(tmp, FALSE)) {
    24242424            log_to_screen("User has not specified a valid /dev entry");
     
    25352535        /*  Force NFS to be the protocol by default */
    25362536        if (bkpinfo->netfs_proto == NULL) {
    2537             mr_asprintf(&(bkpinfo->netfs_proto), "nfs");
     2537            mr_asprintf(bkpinfo->netfs_proto, "nfs");
    25382538        }
    25392539        if (bkpinfo->disaster_recovery) {
     
    25492549        }
    25502550        mr_free(bkpinfo->netfs_proto);
    2551         mr_asprintf(&(bkpinfo->netfs_proto), "%s", tmp1);
     2551        mr_asprintf(bkpinfo->netfs_proto, "%s", tmp1);
    25522552        if (!popup_and_get_string
    25532553            ("Network share", "Which remote share should I mount?",
     
    25702570        mr_free(bkpinfo->netfs_user);
    25712571        if (strcmp(tmp1, "") != 0) {
    2572             mr_asprintf(&(bkpinfo->netfs_user), "%s", tmp1);
     2572            mr_asprintf(bkpinfo->netfs_user, "%s", tmp1);
    25732573        }
    25742574   
     
    25852585            if (bkpinfo->restore_data) {
    25862586                /*  mount th FS read-only in restore mode to avoid any erase of whatever */
    2587                 mr_asprintf(&tmpro, "-o ro");
     2587                mr_asprintf(tmpro, "-o ro");
    25882588            } else {
    2589                 mr_asprintf(&tmpro, "");
     2589                mr_asprintf(tmpro, "");
    25902590            }
    25912591
    25922592            /*  Build the mount string */
    25932593            if (strstr(bkpinfo->netfs_proto, "smbfs")) {
    2594                 mr_asprintf(&tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);
     2594                mr_asprintf(tmp, "mount -t cifs %s %s %s",bkpinfo->netfs_mount, bkpinfo->isodir,tmpro);
    25952595                if (bkpinfo->netfs_user) {
    25962596                    mr_strcat(tmp, " -o user=%s", bkpinfo->netfs_user);
     
    25982598            else {
    25992599                if (strstr(bkpinfo->netfs_proto, "sshfs")) {
    2600                     mr_asprintf(&tmp, "sshfs %s ",tmpro);
     2600                    mr_asprintf(tmp, "sshfs %s ",tmpro);
    26012601                } else {
    2602                     mr_asprintf(&tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);
     2602                    mr_asprintf(tmp, "mount -t %s -o nolock %s ", bkpinfo->netfs_proto,tmpro);
    26032603                }
    26042604                if (bkpinfo->netfs_user) {
     
    27882788        }
    27892789        mr_free(bkpinfo->exclude_paths);
    2790         mr_asprintf(&tmp, "%s", p);
     2790        mr_asprintf(tmp, "%s", p);
    27912791        bkpinfo->exclude_paths = tmp;
    27922792
     
    28152815        if (ask_me_yes_or_no("Do you want to backup extended attributes?")) {
    28162816            if (find_home_of_exe("getfattr")) {
    2817                 mr_asprintf(&g_getfattr,"getfattr");
     2817                mr_asprintf(g_getfattr,"getfattr");
    28182818            }
    28192819            if (find_home_of_exe("getfacl")) {
    2820                 mr_asprintf(&g_getfacl,"getfacl");
     2820                mr_asprintf(g_getfacl,"getfacl");
    28212821            }
    28222822            log_it("Backup of extended attributes");
     
    29342934    char *exclude_these_directories = NULL;
    29352935
    2936     mr_asprintf(&exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));
     2936    mr_asprintf(exclude_these_directories,"%s", call_program_and_get_last_line_of_output("mount -t coda,ncpfs,fuse.sshfs,nfs,nfs4,vmhgfs,smbfs,cifs,afs,gfs,ocfs,ocfs2,mvfs,nsspool,nssvol | tr -s '\t' ' ' | cut -d' ' -f3 | tr -s '\n' '|' | awk '{print $0;}'"));
    29372937    log_msg(9,"list_of_NETFS_mounts_only returns %s\n",exclude_these_directories);
    29382938    return(exclude_these_directories);
     
    30333033//  log_it("Asking what_number_cd_is_this");
    30343034    if (g_ISO_restore_mode) {
    3035         mr_asprintf(&tmp, "mount | grep iso9660 | awk '{print $3;}'");
    3036 
    3037         mr_asprintf(&mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
     3035        mr_asprintf(tmp, "mount | grep iso9660 | awk '{print $3;}'");
     3036
     3037        mr_asprintf(mountdev, "%s%s", call_program_and_get_last_line_of_output(tmp), "/archives/THIS-CD-NUMBER");
    30383038        cd_number = atoi(last_line_of_file(mountdev));
    30393039        paranoid_free(mountdev);
     
    30433043    }
    30443044
    3045     mr_asprintf(&mountdev, "%s", bkpinfo->media_device);
     3045    mr_asprintf(mountdev, "%s", bkpinfo->media_device);
    30463046    if (!mountdev[0]) {
    30473047        log_it
     
    31773177    assert(which_device != NULL);
    31783178
    3179     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());
     3179    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());
    31803180    log_it("list_drives_cmd = %s", list_drives_cmd);
    31813181
     
    32193219    } else {
    32203220        // We need to look on each partition then
    3221         mr_asprintf(&list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     3221        mr_asprintf(list_drives_cmd, "parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    32223222        log_it("list_drives_cmd = %s", list_drives_cmd);
    32233223
     
    33223322            log_msg(1, "curr_fname = %s", curr_fname);
    33233323            sprintf(command, "file %s", curr_fname);
    3324             mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     3324            mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    33253325            for (p = tmp + strlen(tmp); p != tmp && *p != '`' && *p != ' ';
    33263326                 p--);
    33273327            p++;
    3328             mr_asprintf(&scratch, "%s", p);
     3328            mr_asprintf(scratch, "%s", p);
    33293329            for (p = scratch; *p != '\0' && *p != '\''; p++);
    33303330            *p = '\0';
     
    33733373    sprintf(fdisk, "/sbin/parted2fdisk");
    33743374    sprintf(command, "%s -l %s | grep 'EFI GPT'", fdisk, drive);
    3375     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     3375    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    33763376    if (strstr(tmp, "GPT") == NULL) {
    33773377        strcpy(output, "MBR");
  • branches/3.0/mondo/src/common/libmondo-fifo.c

    r2519 r3185  
    8888    for (bufsize = wise_upper_limit, res = -1;
    8989         res != 0 && bufsize >= wise_lower_limit; bufsize--) {
    90         mr_asprintf(&tmp,
     90        mr_asprintf(tmp,
    9191                "dd if=/dev/zero bs=1024 count=16k 2> /dev/null | buffer -o /dev/null -s %ld -m %d%c",
    9292                internal_tape_block_size, bufsize, 'm');
     
    9696    if (!res) {
    9797        bufsize++;
    98         mr_asprintf(&tmp, "Negotiated max buffer of %d MB ", bufsize);
     98        mr_asprintf(tmp, "Negotiated max buffer of %d MB ", bufsize);
    9999        log_to_screen(tmp);
    100100        mr_free(tmp);
     
    120120    }
    121121    log_msg(2, "Calling buffer --- command = '%s'", g_sz_call_to_buffer);
    122     mr_asprintf(&sz_dir, "%c", direction);
     122    mr_asprintf(sz_dir, "%c", direction);
    123123    fres = popen(g_sz_call_to_buffer, sz_dir);
    124124    mr_free(sz_dir);
     
    132132    }
    133133    sleep(2);
    134     mr_asprintf(&tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
     134    mr_asprintf(tmp, "ps %s | grep \"%s\"", ps_options, g_sz_call_to_buffer);
    135135    if (run_program_and_log_output(tmp, 2)) {
    136136        log_msg(2, "Warning - I think I failed to open tape, actually.");
     
    138138    mr_free(tmp);
    139139    g_tape_buffer_size_MB = bufsize;
    140     mr_asprintf(&command, "ps %s | grep buffer | grep -v grep", ps_options);
     140    mr_asprintf(command, "ps %s | grep buffer | grep -v grep", ps_options);
    141141    if (run_program_and_log_output(command, 1)) {
    142142        fres = NULL;
     
    167167    }
    168168    paranoid_system("sync");
    169     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);
     169    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);
    170170    log_msg(2, "kill_buffer() --- command = %s", command);
    171     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     171    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    172172    mr_free(command);
    173173
    174     mr_asprintf(&command, "kill %s", tmp);
     174    mr_asprintf(command, "kill %s", tmp);
    175175    log_msg(2, "kill_buffer() --- command = %s", command);
    176176    if (strlen(tmp) > 0) {
  • branches/3.0/mondo/src/common/libmondo-filelist.c

    r3171 r3185  
    9696    log_to_screen("Dividing filelist into sets. Please wait.");
    9797    i = 0;
    98     mr_asprintf(&filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
     98    mr_asprintf(filelist, "%s/archives/filelist.full", bkpinfo->scratchdir);
    9999    if (!does_file_exist(filelist)) {
    100100        log_it("filelist %s not found", filelist);
     
    107107    estimate_noof_media_required(noof_sets);    // for cosmetic purposes
    108108
    109     mr_asprintf(&tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
     109    mr_asprintf(tempfile, "%s/biggielist.txt", bkpinfo->tmpdir);
    110110    if (!(fout = fopen(tempfile, "a"))) {
    111111        log_OS_error("Cannot append to biggielist");
     
    157157    }                           // no sense in trying to sort an empty file
    158158
    159     mr_asprintf(&tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
    160 
    161     mr_asprintf(&command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
     159    mr_asprintf(tmp_fname, "%s/sortfile", bkpinfo->tmpdir);
     160
     161    mr_asprintf(command, "sort %s > %s 2>> %s", orig_fname, tmp_fname, MONDO_LOGFILE);
    162162    retval = system(command);
    163163    mr_free(command);
     
    167167    } else {
    168168        log_msg(5, "Sorted %s --> %s OK. Copying it back to %s now", orig_fname, tmp_fname, orig_fname);
    169         mr_asprintf(&command, "mv -f %s %s", tmp_fname, orig_fname);
     169        mr_asprintf(command, "mv -f %s %s", tmp_fname, orig_fname);
    170170        retval += run_program_and_log_output(command, 5);
    171171        mr_free(command);
     
    237237    curr_set_no = 0;
    238238    curr_set_size = 0;
    239     mr_asprintf(&outfname, "%s/filelist.%ld", outdir, curr_set_no);
    240     mr_asprintf(&biggie_fname, "%s/biggielist.txt", outdir);
     239    mr_asprintf(outfname, "%s/filelist.%ld", outdir, curr_set_no);
     240    mr_asprintf(biggie_fname, "%s/biggielist.txt", outdir);
    241241    log_it("outfname=%s; biggie_fname=%s", outfname, biggie_fname);
    242242    if (!(fbig = fopen(biggie_fname, "w"))) {
     
    255255    }
    256256
    257     mr_getline(&incoming, fin);
     257    mr_getline(incoming, fin);
    258258    while (!feof(fin)) {
    259259        lino++;
     
    288288                curr_set_size = 0;
    289289
    290                 mr_asprintf(&outfname, "%s/filelist.%ld", outdir, curr_set_no);
     290                mr_asprintf(outfname, "%s/filelist.%ld", outdir, curr_set_no);
    291291                if (!(fout = fopen(outfname, "w"))) {
    292292                    log_OS_error("Unable to openout outfname");
     
    301301        }
    302302        mr_free(incoming);
    303         mr_getline(&incoming, fin);
     303        mr_getline(incoming, fin);
    304304    }
    305305    mr_free(incoming);
     
    320320    mr_free(biggie_fname);
    321321
    322     mr_asprintf(&outfname, "%s/LAST-FILELIST-NUMBER", outdir);
    323     mr_asprintf(&tmp, "%ld", curr_set_no);
     322    mr_asprintf(outfname, "%s/LAST-FILELIST-NUMBER", outdir);
     323    mr_asprintf(tmp, "%ld", curr_set_no);
    324324    if (write_one_liner_data_file(outfname, tmp)) {
    325325        log_OS_error
     
    331331
    332332    if (curr_set_no == 0) {
    333         mr_asprintf(&tmp, "Only one fileset. Fine.");
     333        mr_asprintf(tmp, "Only one fileset. Fine.");
    334334    } else {
    335         mr_asprintf(&tmp, "Filelist divided into %ld sets", curr_set_no + 1);
     335        mr_asprintf(tmp, "Filelist divided into %ld sets", curr_set_no + 1);
    336336    }
    337337    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(&syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp);   // " MONDO_LOGFILE);
     473        mr_asprintf(syscall, "%s '%s' 2>> /dev/null", syscall_sprintf, tmp);    // " MONDO_LOGFILE);
    474474        paranoid_free(tmp);
    475475        log_msg(20,"calling %s\n",syscall);
     
    490490
    491491    if (g_getfacl != NULL) {
    492         mr_asprintf(&command, "touch \"%s\"", facl_fname);
     492        mr_asprintf(command, "touch \"%s\"", facl_fname);
    493493        run_program_and_log_output(command, 8);
    494494        mr_free(command);
     
    506506
    507507    if (g_getfattr != NULL) {
    508         mr_asprintf(&command, "touch \"%s\"", fattr_fname);
     508        mr_asprintf(command, "touch \"%s\"", fattr_fname);
    509509        run_program_and_log_output(command, 8);
    510510        mr_free(command);
     
    538538        if (strstr(executable,"acl")) {
    539539            /*  setfacl needs no additional option for physical walk */
    540             mr_asprintf(&tmp,"");
     540            mr_asprintf(tmp,"");
    541541        } else {
    542542            /*  setfattr needs option -h for physical walk */
    543             mr_asprintf(&tmp,"-h");
    544         }
    545         mr_asprintf(&command, "gzip -dc %s | %s %s --restore - 2>> %s", original_exat_fname, executable, tmp, MONDO_LOGFILE);
     543            mr_asprintf(tmp,"-h");
     544        }
     545        mr_asprintf(command, "gzip -dc %s | %s %s --restore - 2>> %s", original_exat_fname, executable, tmp, MONDO_LOGFILE);
    546546        mr_free(tmp);
    547547        log_msg(1, "command = %s", command);
     
    560560    malloc_string(current_subset_file);
    561561    malloc_string(current_master_file);
    562     mr_asprintf(&masklist, "%s/masklist", bkpinfo->tmpdir);
    563     mr_asprintf(&command, "cp -f %s %s", orig_msklist, masklist);
     562    mr_asprintf(masklist, "%s/masklist", bkpinfo->tmpdir);
     563    mr_asprintf(command, "cp -f %s %s", orig_msklist, masklist);
    564564    run_program_and_log_output(command, 1);
    565565    mr_free(command);
     
    568568    current_subset_file[0] = current_master_file[0] = '\0';
    569569
    570     mr_asprintf(&syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
     570    mr_asprintf(syscall_pout, "%s --restore - 2>> %s", executable, MONDO_LOGFILE);
    571571    log_msg(1, "syscall_pout = %s", syscall_pout);
    572572    pout = popen(syscall_pout, "w");
     
    579579    }
    580580
    581     mr_asprintf(&syscall_pin, "gzip -dc %s", original_exat_fname);
     581    mr_asprintf(syscall_pin, "gzip -dc %s", original_exat_fname);
    582582    log_msg(1, "syscall_pin = %s", syscall_pin);
    583583    pin = popen(syscall_pin, "r");
     
    720720
    721721    strcpy(val_sz,"");
    722     mr_asprintf(&cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
     722    mr_asprintf(cfg_fname, "%s/mondo-restore.cfg", bkpinfo->tmpdir);
    723723    read_cfg_var(cfg_fname, "last-filelist-number", val_sz);
    724724    mr_free(cfg_fname);
     
    882882    }
    883883    log_to_screen("Loading filelist");
    884     mr_asprintf(&tmp1, "zcat %s | wc -l", filelist_fname);
     884    mr_asprintf(tmp1, "zcat %s | wc -l", filelist_fname);
    885885    log_msg(6, "tmp1 = %s", tmp1);
    886886    lines_in_filelist = atol(call_program_and_get_last_line_of_output(tmp1));
     
    902902    (filelist->down)->expanded = (filelist->down)->selected = FALSE;
    903903
    904     mr_asprintf(&command_to_open_fname, "gzip -dc %s", filelist_fname);
     904    mr_asprintf(command_to_open_fname, "gzip -dc %s", filelist_fname);
    905905    if (!(pin = popen(command_to_open_fname, "r"))) {
    906906        log_OS_error("Unable to openin filelist_fname");
     
    12841284    bool in_quotes = FALSE;
    12851285
    1286     mr_asprintf(&sz_res, "%s", incoming);
     1286    mr_asprintf(sz_res, "%s", incoming);
    12871287    p = sz_res;
    12881288    while ((*p != '|' || in_quotes) && *p != '\0') {
     
    13521352        }
    13531353    }
    1354     mr_asprintf(&find_excludes, " ");
     1354    mr_asprintf(find_excludes, " ");
    13551355
    13561356    if (!depth) {
     
    13701370#if linux
    13711371        // 2.6 has /sys as a proc-type thing -- must be excluded
    1372         mr_asprintf(&strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
     1372        mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -fstype devpts -prune -o -fstype tmpfs -prune -o -fstype devtmpfs -prune -o -fstype proc -prune -o -fstype selinuxfs -prune -o -fstype securityfs -prune -o -fstype hugetlbfs -o -fstype cgroup -prune -prune -o -fstype mqueue -prune -o -fstype debugfs -prune -o -fstype sysfs -prune -o -fstype rpc_pipefs -prune -o -fstype none -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
    13731373#else
    13741374        // On BSD, for example, /sys is the kernel sources -- don't exclude
    1375         mr_asprintf(&strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
     1375        mr_asprintf(strtmp, "find '%s' -maxdepth %d -fstype mvfs -prune -o -path /proc -prune -o %s -type d -print > %s 2> /dev/null", dir, MAX_SKEL_DEPTH, find_excludes, g_skeleton_filelist);
    13761376#endif
    13771377        paranoid_free(find_excludes);
     
    13791379        paranoid_system(strtmp);
    13801380        paranoid_free(strtmp);
    1381         mr_asprintf(&tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
     1381        mr_asprintf(tmp, "wc -l %s | awk '{print $1;}'", g_skeleton_filelist);
    13821382        g_skeleton_entries =
    13831383            1 + atol(call_program_and_get_last_line_of_output(tmp));
     
    14111411                    int cols, rows;
    14121412                    newtGetScreenSize(&cols, &rows);
    1413                     mr_asprintf(&tmp, "Reading %-*s", cols, dir1);
     1413                    mr_asprintf(tmp, "Reading %-*s", cols, dir1);
    14141414                    newtDrawRootText(0, g_noof_rows - 3, tmp);
    14151415                    mr_free(tmp);
     
    14241424
    14251425//  log_msg(0, "Cataloguing %s", dir);
    1426     mr_asprintf(&skip_these, "|%s|", sth);
     1426    mr_asprintf(skip_these, "|%s|", sth);
    14271427   
    1428     mr_asprintf(&new_with_pipe, "|%s|", dir1);
     1428    mr_asprintf(new_with_pipe, "|%s|", dir1);
    14291429    if ((dip = opendir(dir1)) == NULL) {
    1430         mr_asprintf(&tmp,"opendir %s", dir1);
     1430        mr_asprintf(tmp,"opendir %s", dir1);
    14311431        log_OS_error(tmp);
    14321432        paranoid_free(tmp);
     
    14401440            i++;
    14411441            if (strcmp(dir1, "/")) {
    1442                 mr_asprintf(&new,"%s/%s",dir1,dit->d_name);
     1442                mr_asprintf(new,"%s/%s",dir1,dit->d_name);
    14431443            } else {
    1444                 mr_asprintf(&new,"%s%s",dir1,dit->d_name);
     1444                mr_asprintf(new,"%s%s",dir1,dit->d_name);
    14451445            }
    14461446            paranoid_free(new_with_pipe);
    1447             mr_asprintf(&new_with_pipe, "|%s|", new);
     1447            mr_asprintf(new_with_pipe, "|%s|", new);
    14481448            if (strstr(skip_these, new_with_pipe)) {
    14491449                fprintf(fout, "%s\n", new);
     
    14671467                                counter = 0;
    14681468                                uberctr++;
    1469                                 mr_asprintf(&tmp, " %c ", special_dot_char(uberctr));
     1469                                mr_asprintf(tmp, " %c ", special_dot_char(uberctr));
    14701470#ifndef _XWIN
    14711471                                if (!g_text_mode) {
     
    15361536    malloc_string(tmp);
    15371537    malloc_string(g_skeleton_filelist);
    1538     mr_asprintf(&sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
     1538    mr_asprintf(sz_datefile,MONDO_CACHE"/difflevel.%d" , 0);
    15391539    if (!include_paths && !userdef_filelist) {
    15401540        fatal_error
     
    15421542    }
    15431543// make hole for filelist
    1544     mr_asprintf(&command, "mkdir -p %s/archives", scratchdir);
     1544    mr_asprintf(command, "mkdir -p %s/archives", scratchdir);
    15451545    paranoid_system(command);
    15461546    mr_free(command);
    15471547
    1548     mr_asprintf(&sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
     1548    mr_asprintf(sz_filelist, "%s/tmpfs/filelist.full", tmpdir);
    15491549    make_hole_for_file(sz_filelist);
    15501550
    15511551    if (differential == 0) {
    15521552        // restore last good datefile if it exists
    1553         mr_asprintf(&command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
     1553        mr_asprintf(command, "cp -f %s.aborted %s", sz_datefile, sz_datefile);
    15541554        run_program_and_log_output(command, 3);
    15551555        mr_free(command);
     
    15571557        // backup last known good datefile just in case :)
    15581558        if (does_file_exist(sz_datefile)) {
    1559             mr_asprintf(&command, "mv -f %s %s.aborted", sz_datefile,
     1559            mr_asprintf(command, "mv -f %s %s.aborted", sz_datefile,
    15601560                    sz_datefile);
    15611561            paranoid_system(command);
     
    15821582                "Using the user-specified filelist - %s - instead of calculating one",
    15831583                userdef_filelist);
    1584         mr_asprintf(&command, "cp -f %s %s", userdef_filelist, sz_filelist);
     1584        mr_asprintf(command, "cp -f %s %s", userdef_filelist, sz_filelist);
    15851585        if (run_program_and_log_output(command, 3)) {
    15861586            mr_free(command);
     
    15911591        log_msg(2, "include_paths = '%s'", include_paths);
    15921592        log_msg(1, "Calculating filelist");
    1593         mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
     1593        mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output("mount | grep -Ew 'ntfs|ntfs-3g|fat|vfat|dos' | awk '{print $3}'"));
    15941594        if (strlen(tmp2) < 1) {
    1595             mr_asprintf(&tmp1," ");
     1595            mr_asprintf(tmp1," ");
    15961596        } else {
    15971597            log_msg(2, "Found windows FS: %s",tmp2);
    1598             mr_asprintf(&tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
     1598            mr_asprintf(tmp1, "find %s -name '/win386.swp' -o -name '/hiberfil.sys' -o -name '/pagefile.sys' 2> /dev/null\n",tmp2);
    15991599            paranoid_free(tmp2);
    1600             mr_asprintf(&tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
     1600            mr_asprintf(tmp2, "%s", call_program_and_get_last_line_of_output(tmp1));
    16011601            log_msg(2, "Found windows files: %s",tmp2);
    16021602        }
    16031603        paranoid_free(tmp1);
    16041604
    1605         mr_asprintf(&exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/run|/dev/shm|"MINDI_CACHE, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
     1605        mr_asprintf(exclude_paths, MONDO_CACHE"|%s|%s|%s|.|..|"MNT_CDROM"|"MNT_FLOPPY"|/media|/tmp|/proc|/sys|/run|/dev/shm|"MINDI_CACHE, tmp2, (tmpdir[0] == '/' && tmpdir[1] == '/') ? (tmpdir + 1) : tmpdir, (scratchdir[0] == '/' && scratchdir[1] == '/') ? (scratchdir + 1) : scratchdir);
    16061606        if (excp != NULL) {
    16071607            mr_strcat(exclude_paths,"|%s",excp);
     
    16401640    }
    16411641    log_msg(2, "Copying new filelist to scratchdir");
    1642     mr_asprintf(&command, "mkdir -p %s/archives", scratchdir);
     1642    mr_asprintf(command, "mkdir -p %s/archives", scratchdir);
    16431643    paranoid_system(command);
    16441644    mr_free(command);
    16451645
    1646     mr_asprintf(&command, "cp -f %s %s/archives/", sz_filelist, scratchdir);
     1646    mr_asprintf(command, "cp -f %s %s/archives/", sz_filelist, scratchdir);
    16471647    paranoid_system(command);
    16481648    mr_free(command);
    16491649
    1650     mr_asprintf(&command, "mv -f %s %s", sz_filelist, tmpdir);
     1650    mr_asprintf(command, "mv -f %s %s", sz_filelist, tmpdir);
    16511651    paranoid_system(command);
    16521652    mr_free(command);
  • branches/3.0/mondo/src/common/libmondo-fork.c

    r3060 r3185  
    134134
    135135    if ((bkpinfo->netfs_user) && (strstr(bkpinfo->netfs_proto,"nfs"))) {
    136         mr_asprintf(&tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call);
     136        mr_asprintf(tmp1, "su - %s -c \"%s\"", bkpinfo->netfs_user, basic_call);
    137137    } else {
    138         mr_asprintf(&tmp1, "%s", basic_call);
     138        mr_asprintf(tmp1, "%s", basic_call);
    139139    }
    140140
     
    285285        log_if_failure = TRUE;
    286286    }
    287     mr_asprintf(&callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
     287    mr_asprintf(callstr, "%s > %s/mondo-run-prog-thing.tmp 2> %s/mondo-run-prog-thing.err", program, bkpinfo->tmpdir, bkpinfo->tmpdir);
    288288    while ((p = strchr(callstr, '\r'))) {
    289289        *p = ' ';
     
    301301    mr_free(callstr);
    302302
    303     mr_asprintf(&callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
     303    mr_asprintf(callstr, "cat %s/mondo-run-prog-thing.err >> %s/mondo-run-prog-thing.tmp 2> /dev/null", bkpinfo->tmpdir, bkpinfo->tmpdir);
    304304    if (log_if_failure && system(callstr)) {
    305305        log_OS_error("Command failed");
     
    307307    mr_free(callstr);
    308308
    309     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
     309    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.err", bkpinfo->tmpdir);
    310310    unlink(tmp1);
    311311    mr_free(tmp1);
    312312
    313     mr_asprintf(&tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
     313    mr_asprintf(tmp1, "%s/mondo-run-prog-thing.tmp", bkpinfo->tmpdir);
    314314    fin = fopen(tmp1, "r");
    315315    if (fin) {
     
    378378    sprintf(lockfile, "%s/mojo-jojo.bla.bla", bkpinfo->tmpdir);
    379379
    380     mr_asprintf(&command,
     380    mr_asprintf(command,
    381381            "echo hi > %s ; %s >> %s 2>> %s; res=$?; sleep 1; rm -f %s; exit $res",
    382382            lockfile, basic_call, MONDO_LOGFILE, MONDO_LOGFILE, lockfile);
    383383    open_evalcall_form(what_i_am_doing);
    384     mr_asprintf(&tmp, "Executing %s", basic_call);
     384    mr_asprintf(tmp, "Executing %s", basic_call);
    385385    log_msg(2, tmp);
    386386    mr_free(tmp);
     
    388388    if (!(fin = popen(command, "r"))) {
    389389        log_OS_error("Unable to popen-in command");
    390         mr_asprintf(&tmp, "Failed utterly to call '%s'", command);
     390        mr_asprintf(tmp, "Failed utterly to call '%s'", command);
    391391        log_to_screen(tmp);
    392392        mr_free(tmp);
  • branches/3.0/mondo/src/common/libmondo-mountlist.c

    r3060 r3185  
    7272    /*@ initialize ***************************************************** */
    7373    prev_part_no = 0;
    74     mr_asprintf(&flaws_str, "%s", "");
     74    mr_asprintf(flaws_str, "%s", "");
    7575
    7676
     
    7878
    7979    if (physical_drive_size < 0) {
    80         mr_asprintf(&tmp, " %s does not exist.", drive);
     80        mr_asprintf(tmp, " %s does not exist.", drive);
    8181        mr_strcat(flaws_str, "%s", tmp);
    8282    } else {
    83         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     83        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    8484    }
    8585    log_it(tmp);
     
    103103            /* is it too big? */
    104104            if (curr_part_no > 'h') {
    105                 mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     105                mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    106106                log_it(tmp);
    107107                mr_strcat(flaws_str, tmp);
     
    117117            }
    118118            if (device_copies > 1) {
    119                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     119                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    120120                if (!strstr(flaws_str, tmp)) {
    121121                    log_it(tmp);
     
    128128            if (mountlist->el[pos].size < 8192
    129129                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    130                 mr_asprintf(&tmp, " %s is tiny!", device);
     130                mr_asprintf(tmp, " %s is tiny!", device);
    131131                log_it(tmp);
    132132                mr_strcat(flaws_str, tmp);
     
    141141                && strcmp(mountlist->el[pos].mountpoint, "none")
    142142                && mountlist->el[pos].mountpoint[0] != '/') {
    143                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     143                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    144144                log_it(tmp);
    145145                mr_strcat(flaws_str, tmp);
     
    149149            /* is format sensible? */
    150150            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    151                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     151                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    152152                log_it(tmp);
    153153                mr_strcat(flaws_str, tmp);
     
    181181            if (curr_part_no - prev_part_no > 1) {
    182182                if (prev_part_no == 0) {
    183                     mr_asprintf(&tmp, " Gap prior to %s.", device);
     183                    mr_asprintf(tmp, " Gap prior to %s.", device);
    184184                    log_it(tmp);
    185185                    mr_strcat(flaws_str, "%s", tmp);
     
    188188                } else if (curr_part_no > 5
    189189                           || (curr_part_no <= 4 && prev_part_no > 0)) {
    190                     mr_asprintf(&tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
     190                    mr_asprintf(tmp, " Gap between %ss%d and %d.", drive, prev_part_no, curr_part_no);
    191191                    log_it(tmp);
    192192                    mr_strcat(flaws_str, "%s", tmp);
     
    200200            if ((curr_part_no >= 5 && prev_part_no == 4)
    201201                && (strcmp(part_table_fmt, "MBR") == 0)) {
    202                 mr_asprintf(&tmp, " Partition %ss4 is occupied.", drive);
     202                mr_asprintf(tmp, " Partition %ss4 is occupied.", drive);
    203203                log_it(tmp);
    204204                mr_strcat(flaws_str, "%s", tmp);
     
    214214            }
    215215            if (device_copies > 1) {
    216                 mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     216                mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    217217                if (!strstr(flaws_str, "%s", tmp)) {
    218218                    log_it(tmp);
     
    225225            if (mountlist->el[pos].size < 8192
    226226                && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    227                 mr_asprintf(&tmp, " %s is tiny!", device);
     227                mr_asprintf(tmp, " %s is tiny!", device);
    228228                log_it(tmp);
    229229                mr_strcat(flaws_str, "%s", tmp);
     
    238238                && strcmp(mountlist->el[pos].mountpoint, "none")
    239239                && mountlist->el[pos].mountpoint[0] != '/') {
    240                 mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     240                mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    241241                log_it(tmp);
    242242                mr_strcat(flaws_str, "%s", tmp);
     
    246246            /* is format sensible? */
    247247            if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    248                 mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     248                mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    249249                log_it(tmp);
    250250                mr_strcat(flaws_str, "%s", tmp);
     
    263263                /* is it too big? */
    264264                if (curr_part_no > 'h') {
    265                     mr_asprintf(&tmp, " Can only have up to 'h' in disklabel.");
     265                    mr_asprintf(tmp, " Can only have up to 'h' in disklabel.");
    266266                    log_it(tmp);
    267267                    mr_strcat(flaws_str, "%s", tmp);
     
    277277                }
    278278                if (device_copies > 1) {
    279                     mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies), device);
     279                    mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies), device);
    280280                    if (!strstr(flaws_str, tmp)) {
    281281                        log_it(tmp);
     
    288288                if (mountlist->el[pos].size < 8192
    289289                    && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    290                     mr_asprintf(&tmp, " %s is tiny!", device);
     290                    mr_asprintf(tmp, " %s is tiny!", device);
    291291                    log_it(tmp);
    292292                    mr_strcat(flaws_str, "%s", tmp);
     
    301301                    && strcmp(mountlist->el[pos].mountpoint, "none")
    302302                    && mountlist->el[pos].mountpoint[0] != '/') {
    303                     mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     303                    mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    304304                    log_it(tmp);
    305305                    mr_strcat(flaws_str, "%s", tmp);
     
    310310                if (!is_this_a_valid_disk_format
    311311                    (mountlist->el[pos].format)) {
    312                     mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     312                    mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    313313                    log_it(tmp);
    314314                    mr_strcat(flaws_str, "%s", tmp);
     
    327327        if (amount_allocated > physical_drive_size) {
    328328            // Used to be +1, but what if you're 1 MB too high?
    329             mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     329            mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    330330                    amount_allocated - physical_drive_size, drive);
    331331            log_it(tmp);
     
    349349    /* Over-allocated the disk? Unallocated space on disk? */
    350350    if (amount_allocated < physical_drive_size - 1) {   /* NOT AN ERROR, JUST A WARNING :-) */
    351         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     351        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    352352                physical_drive_size - amount_allocated, drive);
    353353        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    malloc_string(device);
     
    398398    if (physical_drive_size < 0) {
    399399        if (strstr(drive,"/dev/dm-") == NULL) {
    400             mr_asprintf(&tmp, " %s does not exist.", drive);
     400            mr_asprintf(tmp, " %s does not exist.", drive);
    401401            log_it(tmp);
    402402            mr_strcat(flaws_str, "%s", tmp);
     
    405405            goto endoffunc;
    406406        } else {
    407             mr_asprintf(&tmp, " %s (dm) will be setup later on", drive);
     407            mr_asprintf(tmp, " %s (dm) will be setup later on", drive);
    408408            log_it(tmp);
    409409            mr_free(tmp);
    410410        }
    411411    } else {
    412         mr_asprintf(&tmp, "%s is %ld MB", drive, physical_drive_size);
     412        mr_asprintf(tmp, "%s is %ld MB", drive, physical_drive_size);
    413413        log_it(tmp);
    414414        mr_free(tmp);
     
    425425        if (curr_part_no - prev_part_no > 1) {
    426426            if (prev_part_no == 0) {
    427                 mr_asprintf(&tmp, " Gap prior to %s.", device);
     427                mr_asprintf(tmp, " Gap prior to %s.", device);
    428428                log_it(tmp);
    429429                mr_strcat(flaws_str, "%s", tmp);
     
    432432            } else if (curr_part_no > 5
    433433                       || (curr_part_no <= 4 && prev_part_no > 0)) {
    434                 mr_asprintf(&tmp, " Gap on %s between %d and %d.", drive,
     434                mr_asprintf(tmp, " Gap on %s between %d and %d.", drive,
    435435                        prev_part_no, curr_part_no);
    436436                log_it(tmp);
     
    445445        if ((curr_part_no >= 5 && prev_part_no == 4)
    446446            && (strcmp(part_table_fmt, "MBR") == 0)) {
    447             mr_asprintf(&tmp, " Partition 4 of %s is occupied.", drive);
     447            mr_asprintf(tmp, " Partition 4 of %s is occupied.", drive);
    448448            log_it(tmp);
    449449            mr_strcat(flaws_str, "%s", tmp);
     
    459459        }
    460460        if (device_copies > 1) {
    461             mr_asprintf(&tmp, " %s %s's.", number_to_text(device_copies),
     461            mr_asprintf(tmp, " %s %s's.", number_to_text(device_copies),
    462462                    device);
    463463            if (!strstr(flaws_str, tmp)) {
     
    471471        if (mountlist->el[pos].size < 8192
    472472            && strcmp(mountlist->el[pos].mountpoint, "lvm")) {
    473             mr_asprintf(&tmp, " %s is tiny!", device);
     473            mr_asprintf(tmp, " %s is tiny!", device);
    474474            log_it(tmp);
    475475            mr_strcat(flaws_str, "%s", tmp);
     
    483483            && strcmp(mountlist->el[pos].mountpoint, "image")
    484484            && mountlist->el[pos].mountpoint[0] != '/') {
    485             mr_asprintf(&tmp, " %s has a weird mountpoint.", device);
     485            mr_asprintf(tmp, " %s has a weird mountpoint.", device);
    486486            log_it(tmp);
    487487            mr_strcat(flaws_str, "%s", tmp);
     
    491491        /* is format sensible? */
    492492        if (!is_this_a_valid_disk_format(mountlist->el[pos].format)) {
    493             mr_asprintf(&tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
     493            mr_asprintf(tmp, " %s has unsupported format %s.", device, mountlist->el[pos].format);
    494494            log_it(tmp);
    495495            mr_strcat(flaws_str, "%s", tmp);
     
    504504    /* Over-allocated the disk? Unallocated space on disk? */
    505505    if (amount_allocated > physical_drive_size + 1) {
    506         mr_asprintf(&tmp, " %ld MB over-allocated on %s.",
     506        mr_asprintf(tmp, " %ld MB over-allocated on %s.",
    507507                amount_allocated - physical_drive_size, drive);
    508508        log_it(tmp);
     
    511511        res++;
    512512    } else if (amount_allocated < physical_drive_size - 1) {    /* NOT AN ERROR, JUST A WARNING :-) */
    513         mr_asprintf(&tmp, " %ld MB unallocated on %s.",
     513        mr_asprintf(tmp, " %ld MB unallocated on %s.",
    514514                physical_drive_size - amount_allocated, drive);
    515515        log_it(tmp);
     
    570570            (drivelist->el[i].device,
    571571             DONT_KNOW_HOW_TO_EVALUATE_THIS_DEVICE_TYPE)) {
    572             mr_asprintf(&tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
     572            mr_asprintf(tmp, " Not evaluating %s (I don't know how yet)", drivelist->el[i].device);
    573573            log_it(tmp);
    574574            paranoid_free(tmp);
     
    588588    /* Look for duplicate mountpoints in mountlist. */
    589589    for (currline = 0; currline < mountlist->entries; currline++) {
    590         mr_asprintf(&curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
     590        mr_asprintf(curr_mountpoint, "%s", mountlist->el[currline].mountpoint);
    591591        for (i = 0, copies = 0, last_copy = -1; i < mountlist->entries; i++) {
    592592            if (!strcmp(mountlist->el[i].mountpoint, curr_mountpoint)
     
    599599        if (copies > 1 && last_copy == currline
    600600            && strcmp(curr_mountpoint, "raid")) {
    601             mr_asprintf(&tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
     601            mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    602602            mr_strcat(flaws_str, "%s", tmp);
    603603            log_msg(8,"Adding: %s to flaws_str", tmp);
     
    666666    for (lino = 0, noof_drives = 0; lino < mountlist->entries; lino++) {
    667667
    668         mr_asprintf(&drive, "%s", mountlist->el[lino].device);
     668        mr_asprintf(drive, "%s", mountlist->el[lino].device);
    669669        if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    670670            log_msg(8, "Not putting %s in list of drives: it's a virtual drive", drive);
     
    753753                       (void *) &mountlist->el[i],
    754754                       sizeof(struct mountlist_line));
    755                 mr_asprintf(&tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
     755                mr_asprintf(tmp, "%s is available; user may choose to add it to raid device", output_list->el[items - 1].device);
    756756                log_it(tmp);
    757757                paranoid_free(tmp);
     
    874874            if (j < items) {
    875875                strcat(mountlist->el[items].device, "_dup");
    876                 mr_asprintf(&tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
     876                mr_asprintf(tmp, "Duplicate entry in mountlist - renaming to %s", mountlist->el[items].device);
    877877                log_it(tmp);
    878878                paranoid_free(tmp);
    879879            }
    880             mr_asprintf(&tmp, "%s", mountlist->el[items].device);
     880            mr_asprintf(tmp, "%s", mountlist->el[items].device);
    881881            if (strstr(tmp, "/dev/md/")) {
    882882                log_it("format_device() --- Contracting %s", tmp);
     
    10331033    assert(b >= 0);
    10341034
    1035     mr_asprintf(&device, "%s", mountlist->el[a].device);
    1036     mr_asprintf(&mountpoint, "%s", mountlist->el[a].mountpoint);
    1037     mr_asprintf(&format, "%s", mountlist->el[a].format);
     1035    mr_asprintf(device, "%s", mountlist->el[a].device);
     1036    mr_asprintf(mountpoint, "%s", mountlist->el[a].mountpoint);
     1037    mr_asprintf(format, "%s", mountlist->el[a].format);
    10381038
    10391039    size = mountlist->el[a].size;
  • branches/3.0/mondo/src/common/libmondo-raid.c

    r3154 r3185  
    5151    int res;
    5252
    53     mr_asprintf(&command, "grep \"");
     53    mr_asprintf(command, "grep \"");
    5454    if (raidno == -1) {
    5555        mr_strcat(command, "linear");
     
    198198    assert(label != NULL);
    199199
    200     mr_asprintf(&sz_value, "%d", value);
     200    mr_asprintf(sz_value, "%d", value);
    201201    strcpy(raidrec->additional_vars.el[lino].label, label);
    202202    strcpy(raidrec->additional_vars.el[lino].value, sz_value);
     
    587587    fclose(fin);
    588588    log_it("Raidtab loaded successfully.");
    589     mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries);
     589    mr_asprintf(tmp1, "%d RAID devices in raidtab", raidlist->entries);
    590590    log_it(tmp1);
    591591    mr_free(tmp1);
     
    739739        }
    740740        if (!disklist) {
    741             mr_asprintf(&tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
     741            mr_asprintf(tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    742742            log_it(tmp);
    743743            mr_free(tmp);
     
    10321032            }
    10331033            // get RAID device name
    1034             mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1034            mr_asprintf(strtmp,"%s%s", device_prefix, token);
    10351035            strncpy(raidlist->el[raidlist->entries].raid_device, strtmp, 63);
    10361036            raidlist->el[raidlist->entries].raid_device[63] = '\0';
     
    10401040            v = raidlist->el[raidlist->entries].additional_vars.entries;
    10411041            strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "UUID");
    1042             mr_asprintf(&cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);
    1043             mr_asprintf(&strtmp, "%s", call_program_and_get_last_line_of_output(cmd));
     1042            mr_asprintf(cmd,"mdadm --detail %s | grep UUID | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);
     1043            mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd));
    10441044            strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp);
    10451045            mr_free(strtmp);
     
    10471047            // store the Version value in the additional_vars structure
    10481048            strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].label, "Version");
    1049             mr_asprintf(&cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);
    1050             mr_asprintf(&strtmp, "%s", call_program_and_get_last_line_of_output(cmd));
     1049            mr_asprintf(cmd,"mdadm --detail %s | grep Version | cut -d: -f2- | sed 's/^ *//'", raidlist->el[raidlist->entries].raid_device);
     1050            mr_asprintf(strtmp, "%s", call_program_and_get_last_line_of_output(cmd));
    10511051            strcpy(raidlist->el[raidlist->entries].additional_vars.el[v].value, strtmp);
    10521052            mr_free(strtmp);
     
    11281128                case ' ': // normal data disks
    11291129                    raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].index = atoi(pos + 1);
    1130                     mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1130                    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11311131                    strcpy(raidlist->el[raidlist->entries].data_disks.el[raidlist->el[raidlist->entries].data_disks.entries].device, strtmp);
    11321132                    mr_free(strtmp);
     
    11351135                case 'S': // spare disks
    11361136                    raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].index = atoi(pos + 1);
    1137                     mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1137                    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11381138                    strcpy(raidlist->el[raidlist->entries].spare_disks.el[raidlist->el[raidlist->entries].spare_disks.entries].device, strtmp);
    11391139                    mr_free(strtmp);
     
    11421142                case 'F': // failed disks
    11431143                    raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].index = atoi(pos + 1);
    1144                     mr_asprintf(&strtmp,"%s%s", device_prefix, token);
     1144                    mr_asprintf(strtmp,"%s%s", device_prefix, token);
    11451145                    strcpy(raidlist->el[raidlist->entries].failed_disks.el[raidlist->el[raidlist->entries].failed_disks.entries].device, strtmp);
    11461146                    mr_free(strtmp);
  • branches/3.0/mondo/src/common/libmondo-stream.c

    r3150 r3185  
    242242    int res;
    243243
    244     mr_asprintf(&command, "mt -f %s status", dev);
     244    mr_asprintf(command, "mt -f %s status", dev);
    245245    res = run_program_and_log_output(command, 1);
    246246    mr_free(command);
     
    276276        strcpy(cdr_exe, "dvdrecord");
    277277    }
    278     mr_asprintf(&command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l",
     278    mr_asprintf(command, "%s -scanbus 2> /dev/null | grep -i tape | wc -l",
    279279            cdr_exe);
    280280    strcpy(tmp, call_program_and_get_last_line_of_output(command));
     
    287287        return 1;
    288288    }
    289     mr_asprintf(&command,
     289    mr_asprintf(command,
    290290            "%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",
    291291            cdr_exe);
     
    297297        return 1;
    298298    }
    299     mr_asprintf(&command,
     299    mr_asprintf(command,
    300300            "%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",
    301301            cdr_exe);
     
    383383        }
    384384        if (strstr(fname, "xattr") == NULL) {
    385             mr_asprintf(&tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
     385            mr_asprintf(tmp,"Wrong order expected xattr, got %s, sunshine.", fname);
    386386            fatal_error(tmp);
    387387        }
     
    413413        }
    414414        if (strstr(fname, "acl") == NULL) {
    415             mr_asprintf(&tmp,"Wrong order expected acl, got %s, sunshine.", fname);
     415            mr_asprintf(tmp,"Wrong order expected acl, got %s, sunshine.", fname);
    416416            fatal_error(tmp);
    417417        }
     
    479479    log_it("Insisting on tape #%d", tapeno);
    480480    if (g_current_media_number != tapeno) {
    481         mr_asprintf(&tmp,
     481        mr_asprintf(tmp,
    482482                "When the tape drive goes quiet, please insert volume %d in this series.",
    483483                tapeno);
     
    549549        suffix[0] = '\0';
    550550    }
    551     mr_asprintf(&tmpdir, "%s/tmpfs/backcatalog", td);
     551    mr_asprintf(tmpdir, "%s/tmpfs/backcatalog", td);
    552552    mkdir(tmpdir, 0x700);
    553     mr_asprintf(&command, "cp -f %s %s", latest_fname, tmpdir);
     553    mr_asprintf(command, "cp -f %s %s", latest_fname, tmpdir);
    554554    if (run_program_and_log_output(command, 6)) {
    555555        log_it("Warning - failed to copy %s to backcatalog at %s",
     
    579579
    580580    for (i = curr - 1; i >= 0 && curr - i < 10; i--) {
    581         mr_asprintf(&old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
     581        mr_asprintf(old_fname, "%s/%s", tmpdir, g_tapecatalog->el[i].fname);
    582582        unlink(old_fname);
    583583        mr_free(old_fname);
     
    619619        return (0);
    620620    }
    621     mr_asprintf(&tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
     621    mr_asprintf(tmp, "mt -f %s setblk %ld", bkpinfo->media_device, internal_tape_block_size);
    622622    res = run_program_and_log_output(tmp, 3);
    623623    mr_free(tmp);
     
    688688
    689689    log_it("Skipping OBDR headers");
    690     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     690    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    691691    res = run_program_and_log_output(command, 1);
    692692    paranoid_free(command);
    693693
    694     mr_asprintf(&command, "mt -f %s fsf 2",bkpinfo->media_device);
     694    mr_asprintf(command, "mt -f %s fsf 2",bkpinfo->media_device);
    695695    res = run_program_and_log_output(command, 1);
    696696    paranoid_free(command);
     
    715715    log_it("Creating OBDR headers");
    716716    /* OBDR: First block 10 kB of zero bs = 512 */
    717     mr_asprintf(&command, "mt -f %s compression off",bkpinfo->media_device);
     717    mr_asprintf(command, "mt -f %s compression off",bkpinfo->media_device);
    718718    res = run_program_and_log_output(command, 1);
    719719    paranoid_free(command);
    720720
    721     mr_asprintf(&command, "mt -f %s rewind",bkpinfo->media_device);
     721    mr_asprintf(command, "mt -f %s rewind",bkpinfo->media_device);
    722722    res += run_program_and_log_output(command, 1);
    723723    paranoid_free(command);
     
    725725    set_tape_block_size_with_mt(512);
    726726
    727     mr_asprintf(&command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
     727    mr_asprintf(command, "dd if=/dev/zero of=%s bs=512 count=20",bkpinfo->media_device);
    728728    res += run_program_and_log_output(command, 1);
    729729    paranoid_free(command);
     
    732732    set_tape_block_size_with_mt(2048);
    733733
    734     mr_asprintf(&command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
     734    mr_asprintf(command, "dd if=%s of=%s bs=2048",MINDI_CACHE"/mondorescue.iso",bkpinfo->media_device);
    735735    res += run_program_and_log_output(command, 1);
    736736    paranoid_free(command);
     
    739739
    740740    /* restore compression mode on */
    741     mr_asprintf(&command, "mt -f %s compression on",bkpinfo->media_device);
     741    mr_asprintf(command, "mt -f %s compression on",bkpinfo->media_device);
    742742    res = run_program_and_log_output(command, 1);
    743743    paranoid_free(command);
     
    805805
    806806    insist_on_this_tape_number(1);
    807     mr_asprintf(&outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
     807    mr_asprintf(outfname, "%s/tmp/all.tar.gz", bkpinfo->tmpdir);
    808808    make_hole_for_file(outfname);
    809809
     
    874874        // FIXME
    875875    }
    876     mr_asprintf(&tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",
     876    mr_asprintf(tmp, "tar -zxf %s ./tmp/mondo-restore.cfg 2> /dev/null",
    877877            outfname);
    878878    paranoid_system(tmp);
     
    904904
    905905    /*  add 'dummy' if testing */
    906     mr_asprintf(&command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
     906    mr_asprintf(command, "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s", cddev, speed, MONDO_LOGFILE, MONDO_LOGFILE);
    907907    /*  initialise the catalog */
    908908    g_current_media_number = 1;
     
    10781078    }
    10791079    if (orig_size != temp_size && orig_size != -1) {
    1080         mr_asprintf(&tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
     1080        mr_asprintf(tmp, "output file's size should be %ld K but is apparently %ld K", (long) size >> 10, (long) temp_size >> 10);
    10811081        log_to_screen(tmp);
    10821082        mr_free(tmp);
     
    11411141    log_msg(6, ".......................... Should be %lld", orig_size);
    11421142    g_tape_posK += total_read_from_tape_for_this_file / 1024;
    1143     mr_asprintf(&actual_cksum, "%04x%04x", crc16, crctt);
     1143    mr_asprintf(actual_cksum, "%04x%04x", crc16, crctt);
    11441144    if (foutstream) {           /*log_it("Finished writing to foutstream"); */
    11451145    } else {
     
    11511151    }
    11521152    if (strcmp(temp_cksum, actual_cksum)) {
    1153         mr_asprintf(&tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum,
     1153        mr_asprintf(tmp, "actual cksum=%s; recorded cksum=%s", actual_cksum,
    11541154                temp_cksum);
    11551155        log_to_screen(tmp);
    11561156        mr_free(tmp);
    11571157
    1158         mr_asprintf(&tmp, "%s (%ld K) is corrupt on tape", temp_fname,
     1158        mr_asprintf(tmp, "%s (%ld K) is corrupt on tape", temp_fname,
    11591159                (long) orig_size >> 10);
    11601160        log_to_screen(tmp);
     
    14941494    insist_on_this_tape_number(g_current_media_number + 1); // will increment g_current_media, too
    14951495    if (bkpinfo->backup_media_type == cdstream) {
    1496         mr_asprintf(&command,
     1496        mr_asprintf(command,
    14971497                "cdrecord -eject dev=%s speed=%d fs=24m -waiti - >> %s 2>> %s",
    14981498                bkpinfo->media_device, bkpinfo->cdrw_speed, MONDO_LOGFILE,
     
    15491549    last = g_tapecatalog->entries - 1;
    15501550    for (i = 0; i <= last; i++) {
    1551         mr_asprintf(&fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
     1551        mr_asprintf(fname, "%s/tmpfs/backcatalog/%s", bkpinfo->tmpdir, g_tapecatalog->el[i].fname);
    15521552        if (!does_file_exist(fname)) {
    15531553            log_msg(6, "Can't write %s - it doesn't exist.", fname);
     
    16021602    log_it("Data disks = %s", fname);
    16031603    if (!does_file_exist(fname)) {
    1604         mr_asprintf(&tmp, "Cannot find %s", fname);
     1604        mr_asprintf(tmp, "Cannot find %s", fname);
    16051605        log_to_screen(tmp);
    16061606        mr_free(tmp);
     
    17001700        p++;
    17011701    }
    1702     mr_asprintf(&tmp, "Writing file '%s' to tape (%ld KB)", p,
     1702    mr_asprintf(tmp, "Writing file '%s' to tape (%ld KB)", p,
    17031703            (long) filesize >> 10);
    17041704    log_it(tmp);
     
    17451745    }
    17461746    paranoid_fclose(fin);
    1747     mr_asprintf(&checksum, "%04x%04x", crc16, crctt);
     1747    mr_asprintf(checksum, "%04x%04x", crc16, crctt);
    17481748    /* BERLIOS: what does it do ??? */
    17491749    write_header_block_to_stream((off_t)g_current_media_number, checksum, BLK_STOP_FILE);
     
    18081808        fwrite(tempblock, 1, (size_t) TAPE_BLOCK_SIZE,
    18091809               g_tape_stream) / 1024;
    1810     mr_asprintf(&tmp, "%s (fname=%s, size=%ld K)",
     1810    mr_asprintf(tmp, "%s (fname=%s, size=%ld K)",
    18111811            marker_to_string(control_char), p,
    18121812            (long) length_of_incoming_file >> 10);
     
    18371837
    18381838    /*@ end vars *************************************************** */
    1839     mr_asprintf(&tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
     1839    mr_asprintf(tmp, "Wrong marker! (Should be %s, is actually %s)", marker_to_string(should_be), marker_to_string(it_is));
    18401840    log_to_screen(tmp);
    18411841    mr_free(tmp);
  • branches/3.0/mondo/src/common/libmondo-string.c

    r3150 r3185  
    817817
    818818    assert_string_is_neither_NULL_nor_zerolength(partition);
    819     mr_asprintf(&trunc, "%s", partition);
     819    mr_asprintf(trunc, "%s", partition);
    820820
    821821#ifdef __FreeBSD__
     
    11221122    switch (type_of_bkp) {
    11231123    case dvd:
    1124         mr_asprintf(&type_of_backup, "DVD");
     1124        mr_asprintf(type_of_backup, "DVD");
    11251125        break;
    11261126    case cdr:
    1127         mr_asprintf(&type_of_backup, "CDR");
     1127        mr_asprintf(type_of_backup, "CDR");
    11281128        break;
    11291129    case cdrw:
    1130         mr_asprintf(&type_of_backup, "CDRW");
     1130        mr_asprintf(type_of_backup, "CDRW");
    11311131        break;
    11321132    case tape:
    1133         mr_asprintf(&type_of_backup, "tape");
     1133        mr_asprintf(type_of_backup, "tape");
    11341134        break;
    11351135    case cdstream:
    1136         mr_asprintf(&type_of_backup, "CDR");
     1136        mr_asprintf(type_of_backup, "CDR");
    11371137        break;
    11381138    case udev:
    1139         mr_asprintf(&type_of_backup, "udev");
     1139        mr_asprintf(type_of_backup, "udev");
    11401140        break;
    11411141    case iso:
    1142         mr_asprintf(&type_of_backup, "ISO");
     1142        mr_asprintf(type_of_backup, "ISO");
    11431143        break;
    11441144    case netfs:
    1145         mr_asprintf(&type_of_backup, "%s", bkpinfo->netfs_proto);
     1145        mr_asprintf(type_of_backup, "%s", bkpinfo->netfs_proto);
    11461146        break;
    11471147    case usb:
    1148         mr_asprintf(&type_of_backup, "USB");
     1148        mr_asprintf(type_of_backup, "USB");
    11491149        break;
    11501150    default:
    1151         mr_asprintf(&type_of_backup, "ISO");
     1151        mr_asprintf(type_of_backup, "ISO");
    11521152    }
    11531153    return (type_of_backup);
  • branches/3.0/mondo/src/common/libmondo-tools.c

    r3154 r3185  
    224224
    225225    uname(&utsn);
    226     mr_asprintf(&tmp, "%s", utsn.machine);
     226    mr_asprintf(tmp, "%s", utsn.machine);
    227227    return (tmp);
    228228}
     
    400400        }
    401401        log_msg(1, "Tape");
    402         mr_asprintf(&tmp, "mt -f %s status", bkpinfo->media_device);
     402        mr_asprintf(tmp, "mt -f %s status", bkpinfo->media_device);
    403403        log_msg(1, "tmp = '%s'", tmp);
    404404        if (run_program_and_log_output(tmp, 3)) {
     
    446446        }
    447447        if (bkpinfo->nonbootable_backup) {
    448             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
     448            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_NONBOOT);
    449449        } else if
    450450#ifdef __FreeBSD__
     
    455455#ifdef __IA64__
    456456    {
    457         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
     457        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_ELILO);
    458458    }
    459459#else
    460460    {
    461         mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
     461        mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_LILO);
    462462    }
    463463#endif
    464464        else
    465465        {
    466             mr_asprintf(&mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
     466            mr_asprintf(mondo_mkisofs_sz, MONDO_GROWISOFS_REGULAR_SYSLINUX);
    467467        }
    468468        if (bkpinfo->manual_cd_tray) {
     
    478478        }
    479479        if (getenv ("SUDO_COMMAND")) {
    480             mr_asprintf(&command, "strings `which growisofs` | grep -c SUDO_COMMAND");
     480            mr_asprintf(command, "strings `which growisofs` | grep -c SUDO_COMMAND");
    481481            if (!strcmp(call_program_and_get_last_line_of_output(command), "1")) {
    482482                mr_free(command);
     
    494494        || bkpinfo->backup_media_type == cdr) {
    495495        if (!bkpinfo->manual_cd_tray) {
    496             mr_asprintf(&extra_cdrom_params, "-waiti ");
     496            mr_asprintf(extra_cdrom_params, "-waiti ");
    497497        }
    498498        if (bkpinfo->backup_media_type == cdrw) {
    499             mr_asprintf(&extra_cdrom_params, "blank=fast ");
     499            mr_asprintf(extra_cdrom_params, "blank=fast ");
    500500        }
    501501        if (extra_cdrom_params == NULL) {
    502502            // If not initialized earlier, do it now
    503             mr_asprintf(&extra_cdrom_params, " ");
     503            mr_asprintf(extra_cdrom_params, " ");
    504504        }
    505505        if (find_home_of_exe("cdrecord")) {
     
    511511        }
    512512        if (find_home_of_exe("genisoimage")) {
    513             mr_asprintf(&isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);
     513            mr_asprintf(isofs_cmd, "%s", MONDO_GENISOIMAGE_CMD);
    514514        } else {
    515             mr_asprintf(&isofs_cmd, "%s", MONDO_MKISOFS_CMD);
     515            mr_asprintf(isofs_cmd, "%s", MONDO_MKISOFS_CMD);
    516516        }
    517517        if (bkpinfo->nonbootable_backup) {
    518             mr_asprintf(&mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS);
     518            mr_asprintf(mondo_mkisofs_sz, "%s%s", isofs_cmd, MONDO_MKISOFS);
    519519        } else if
    520520#ifdef __FreeBSD__
     
    525525#ifdef __IA64__
    526526    {
    527         mr_asprintf(&mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_ELILO);
     527        mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_ELILO);
    528528    }
    529529#else
    530530    {
    531         mr_asprintf(&mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_LILO);
     531        mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_LILO);
    532532    }
    533533#endif
    534534        else
    535535        {
    536             mr_asprintf(&mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_SYSLINUX);
     536            mr_asprintf(mondo_mkisofs_sz, "%s%s -V _CD#_", isofs_cmd, MONDO_MKISOFS_REGULAR_SYSLINUX);
    537537        }
    538538        mr_free(isofs_cmd);
     
    577577
    578578        log_it("isodir = %s", bkpinfo->isodir);
    579         mr_asprintf(&command, "df -P %s | tail -n1 | cut -d' ' -f1",
     579        mr_asprintf(command, "df -P %s | tail -n1 | cut -d' ' -f1",
    580580                bkpinfo->isodir);
    581581        log_it("command = %s", command);
    582582        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    583         mr_asprintf(&iso_dev, "%s", call_program_and_get_last_line_of_output(command));
    584         mr_asprintf(&tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
     583        mr_asprintf(iso_dev, "%s", call_program_and_get_last_line_of_output(command));
     584        mr_asprintf(tmp, "%s/ISO-DEV", bkpinfo->tmpdir);
    585585        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    586586        mr_free(tmp);
    587587        mr_free(command);
    588588
    589         mr_asprintf(&command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
     589        mr_asprintf(command, "mount | grep -w %s | tail -n1 | cut -d' ' -f3", iso_dev);
    590590        mr_free(iso_dev);
    591591
    592592        log_it("command = %s", command);
    593593        log_it("res of it = %s", call_program_and_get_last_line_of_output(command));
    594         mr_asprintf(&iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
    595         mr_asprintf(&tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
     594        mr_asprintf(iso_mnt, "%s", call_program_and_get_last_line_of_output(command));
     595        mr_asprintf(tmp, "%s/ISO-MNT", bkpinfo->tmpdir);
    596596        write_one_liner_data_file(tmp, call_program_and_get_last_line_of_output(command));
    597597        mr_free(tmp);
     
    599599
    600600        log_it("isomnt: %s, %d", iso_mnt, strlen(iso_mnt));
    601         mr_asprintf(&iso_tmp, "%s", bkpinfo->isodir);
     601        mr_asprintf(iso_tmp, "%s", bkpinfo->isodir);
    602602        if (strlen(iso_tmp) < strlen(iso_mnt)) {
    603             mr_asprintf(&iso_path, "%s", "");
     603            mr_asprintf(iso_path, "%s", "");
    604604        } else {
    605605            // If iso_mnt is only / then iso_path is the full dir
    606606            // (the formula bellow doesn't work in this case)
    607607            if (strcmp(iso_mnt, "/") == 0) {
    608                 mr_asprintf(&iso_path, "%s", iso_tmp);
     608                mr_asprintf(iso_path, "%s", iso_tmp);
    609609            // else it's a part of iso_tmp
    610610            } else {
    611                 mr_asprintf(&iso_path, "%s", iso_tmp + strlen(iso_mnt));
     611                mr_asprintf(iso_path, "%s", iso_tmp + strlen(iso_mnt));
    612612            }
    613613        }
     
    615615        mr_free(iso_mnt);
    616616
    617         mr_asprintf(&tmp, "%s/ISODIR", bkpinfo->tmpdir);
     617        mr_asprintf(tmp, "%s/ISODIR", bkpinfo->tmpdir);
    618618        write_one_liner_data_file(tmp, iso_path);
    619619        mr_free(tmp);
     
    622622        mr_free(iso_path);
    623623
    624         mr_asprintf(&tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
     624        mr_asprintf(tmp, "%s/ISO-PREFIX", bkpinfo->tmpdir);
    625625        write_one_liner_data_file(tmp, bkpinfo->prefix);
    626626        mr_free(tmp);
     
    646646                colon++;
    647647                hent = gethostbyname(colon);
    648                 mr_asprintf(&(bkpinfo->netfs_user),"%s", hostname);
     648                mr_asprintf(bkpinfo->netfs_user,"%s", hostname);
    649649            } else {
    650650                hent = gethostbyname(hostname);
     
    655655                retval++;
    656656            } else {
    657                 mr_asprintf(&ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
     657                mr_asprintf(ip_address, "%s", inet_ntoa((struct in_addr) *((struct in_addr *) hent->h_addr)));
    658658                mr_strcat(ip_address, strchr(bkpinfo->netfs_mount, ':'));
    659659                strcpy(bkpinfo->netfs_mount, ip_address);
     
    709709    }
    710710
    711     mr_asprintf(&tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
     711    mr_asprintf(tmp,"rm -Rf %s/changed.files*",MONDO_CACHE);
    712712    run_program_and_log_output(tmp, FALSE);
    713713    paranoid_free(tmp);
     
    750750        if (strstr(bkpinfo->tmpdir,"mondo.tmp.") != NULL) {
    751751            log_it("Purging old tmpdir %s", bkpinfo->tmpdir);
    752             mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->tmpdir);
     752            mr_asprintf(tmp,"rm -Rf %s",bkpinfo->tmpdir);
    753753        } else {
    754754            log_it("Purging old tmpdir %s/mondo.tmp.*", bkpinfo->tmpdir);
    755             mr_asprintf(&tmp,"rm -Rf %s/mondo.tmp.*",bkpinfo->tmpdir);
     755            mr_asprintf(tmp,"rm -Rf %s/mondo.tmp.*",bkpinfo->tmpdir);
    756756        }
    757757        paranoid_system(tmp);
     
    761761    /* Always take in account arg first, then env, then default */
    762762    if (path != NULL) {
    763         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", path);
     763        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", path);
    764764    } else if (getenv("TMPDIR")) {
    765         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
     765        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("TMPDIR"));
    766766    } else if (getenv("MRTMP")) {
    767         mr_asprintf(&tmp, "%s/mondo.tmp.XXXXXX", getenv("MRTMP"));
     767        mr_asprintf(tmp, "%s/mondo.tmp.XXXXXX", getenv("MRTMP"));
    768768    } else {
    769         mr_asprintf(&tmp, "/tmp/mondo.tmp.XXXXXX");
     769        mr_asprintf(tmp, "/tmp/mondo.tmp.XXXXXX");
    770770    }
    771771    p = mkdtemp(tmp);
     
    777777    paranoid_free(tmp);
    778778
    779     mr_asprintf(&tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
     779    mr_asprintf(tmp, "mkdir -p %s/tmpfs", bkpinfo->tmpdir);
    780780    paranoid_system(tmp);
    781781    mr_free(tmp);
     
    794794        if (strstr(bkpinfo->scratchdir,"mondo.scratch.") != NULL) {
    795795            log_it("Purging old scratchdir %s", bkpinfo->scratchdir);
    796             mr_asprintf(&tmp,"rm -Rf %s",bkpinfo->scratchdir);
     796            mr_asprintf(tmp,"rm -Rf %s",bkpinfo->scratchdir);
    797797        } else {
    798798            log_it("Purging old scratchdir %s/mondo.scratch.*", bkpinfo->scratchdir);
    799             mr_asprintf(&tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir);
     799            mr_asprintf(tmp,"rm -Rf %s/mondo.scratch.*",bkpinfo->scratchdir);
    800800        }
    801801        paranoid_system(tmp);
     
    805805    /* Always take in account arg first, then env, then default */
    806806    if (path != NULL) {
    807         mr_asprintf(&tmp, "%s/mondo.scratch.XXXXXX", path);
     807        mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", path);
    808808    } else if (getenv("MRSCRATCH")) {
    809         mr_asprintf(&tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH"));
     809        mr_asprintf(tmp, "%s/mondo.scratch.XXXXXX", getenv("MRSCRATCH"));
    810810    } else {
    811         mr_asprintf(&tmp, "/tmp/mondo.scratch.XXXXXX");
     811        mr_asprintf(tmp, "/tmp/mondo.scratch.XXXXXX");
    812812    }
    813813    p = mkdtemp(tmp);
     
    819819    paranoid_free(tmp);
    820820
    821     mr_asprintf(&tmp, "mkdir -p %s", bkpinfo->scratchdir);
     821    mr_asprintf(tmp, "mkdir -p %s", bkpinfo->scratchdir);
    822822    paranoid_system(tmp);
    823823    mr_free(tmp);
     
    909909    assert_string_is_neither_NULL_nor_zerolength(partition);
    910910
    911     mr_asprintf(&command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
     911    mr_asprintf(command, "df -m -P %s 1> /dev/null 2> /dev/null", partition);
    912912    if (system(command)) {
    913913        mr_free(command);
     
    916916    mr_free(command);
    917917
    918     mr_asprintf(&command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
     918    mr_asprintf(command, "df -m -P %s | tail -n1 | tr -s ' ' '\t' | cut -f4",
    919919            partition);
    920     mr_asprintf(&out_sz, "%s", call_program_and_get_last_line_of_output(command));
     920    mr_asprintf(out_sz, "%s", call_program_and_get_last_line_of_output(command));
    921921    mr_free(command);
    922922
     
    962962            ("ln -sf `which mkfs.msdos` /sbin/mkfs.vfat", FALSE);
    963963    }
    964     mr_asprintf(&tmp, "%s",
     964    mr_asprintf(tmp, "%s",
    965965           call_program_and_get_last_line_of_output
    966966           ("free | grep Mem | head -n1 | tr -s ' ' '\t' | cut -f2"));
     
    10281028    run_program_and_log_output
    10291029        ("umount `mount | grep cdr | cut -d' ' -f3 | tr '\n' ' '`", 5);
    1030     mr_asprintf(&tmp, "%s",
     1030    mr_asprintf(tmp, "%s",
    10311031           call_program_and_get_last_line_of_output
    10321032           ("mount | grep -E \"cdr(om|w)\""));
     
    10631063        fatal_error("Please reinstall Mondo and Mindi.");
    10641064    }
    1065     mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
     1065    mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test", bkpinfo->tmpdir);
    10661066    if (run_program_and_log_output(tmp, 5)) {
    10671067        mr_free(tmp);
    1068         mr_asprintf(&tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
     1068        mr_asprintf(tmp, "mindi --makemountlist %s/mountlist.txt.test failed for some reason.", bkpinfo->tmpdir);
    10691069        log_to_screen(tmp);
    10701070        log_to_screen
     
    11111111    assert_string_is_neither_NULL_nor_zerolength(label);
    11121112    if (!does_file_exist(config_file)) {
    1113         mr_asprintf(&tmp, "(read_cfg_var) Cannot find %s config file",
     1113        mr_asprintf(tmp, "(read_cfg_var) Cannot find %s config file",
    11141114                config_file);
    11151115        log_to_screen(tmp);
     
    11221122        return (0);
    11231123    } else {
    1124         mr_asprintf(&command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",
     1124        mr_asprintf(command, "grep '%s .*' %s| cut -d' ' -f2,3,4,5",
    11251125                label, config_file);
    11261126        strcpy(value, call_program_and_get_last_line_of_output(command));
     
    12061206        log_msg(3, "%s --- autofs detected", g_autofs_exe);
    12071207        // FIXME -- only disable it if it's running ---  sprintf(tmp, "%s status", autofs_exe);
    1208         mr_asprintf(&tmp, "%s stop", g_autofs_exe);
     1208        mr_asprintf(tmp, "%s stop", g_autofs_exe);
    12091209        if (run_program_and_log_output(tmp, 2)) {
    12101210            log_it("Failed to stop autofs - I assume it wasn't running");
     
    12281228        return;
    12291229    }
    1230     mr_asprintf(&tmp, "%s start", g_autofs_exe);
     1230    mr_asprintf(tmp, "%s start", g_autofs_exe);
    12311231    if (run_program_and_log_output(tmp, 2)) {
    12321232        log_it("Failed to start autofs");
     
    12511251    g_boot_mountpt[0] = '\0';
    12521252    log_msg(4, "Done. Great. Seeting command to something");
    1253     mr_asprintf(&command, "%s",
     1253    mr_asprintf(command, "%s",
    12541254           "grep -v \":\" /etc/fstab | grep -vE '^#.*$' | grep -E \"[   ]/boot[     ]\" | tr -s ' ' '\t' | cut -f1 | head -n1");
    12551255    log_msg(4, "Cool. Command = '%s'", command);
    1256     mr_asprintf(&tmp, "%s", call_program_and_get_last_line_of_output(command));
     1256    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    12571257    mr_free(command);
    12581258
     
    12601260    if (tmp[0]) {
    12611261        log_it("/boot is at %s according to /etc/fstab", tmp);
    1262         mr_asprintf(&command, "mount | grep -Ew '/boot'");
     1262        mr_asprintf(command, "mount | grep -Ew '/boot'");
    12631263        mr_free(tmp);
    1264         mr_asprintf(&tmp, call_program_and_get_last_line_of_output(command));
     1264        mr_asprintf(tmp, call_program_and_get_last_line_of_output(command));
    12651265        mr_free(command);
    12661266
     
    12741274                }
    12751275            } else {
    1276                 mr_asprintf(&command, "mount | grep -E '^%s'", tmp);
     1276                mr_asprintf(command, "mount | grep -E '^%s'", tmp);
    12771277                log_msg(3, "command = %s", command);
    12781278                if (run_program_and_log_output(command, 5)) {
    12791279                    strcpy(g_boot_mountpt, tmp);
    12801280                    mr_free(tmp);
    1281                     mr_asprintf(&tmp,
     1281                    mr_asprintf(tmp,
    12821282                            "%s (your /boot partition) is not mounted. I'll mount it before backing up",
    12831283                            g_boot_mountpt);
     
    12851285                    mr_free(tmp);
    12861286
    1287                     mr_asprintf(&tmp, "mount %s", g_boot_mountpt);
     1287                    mr_asprintf(tmp, "mount %s", g_boot_mountpt);
    12881288                    if (run_program_and_log_output(tmp, 5)) {
    12891289                        g_boot_mountpt[0] = '\0';
     
    13161316    log_msg(3, "starting");
    13171317    if (g_boot_mountpt[0]) {
    1318         mr_asprintf(&tmp, "umount %s", g_boot_mountpt);
     1318        mr_asprintf(tmp, "umount %s", g_boot_mountpt);
    13191319        if (run_program_and_log_output(tmp, 5)) {
    13201320            log_it("WARNING - unable to unmount /boot");
     
    13481348    assert(value != NULL);
    13491349    if (!does_file_exist(config_file)) {
    1350         mr_asprintf(&tmp, "(write_cfg_file) Cannot find %s config file",
     1350        mr_asprintf(tmp, "(write_cfg_file) Cannot find %s config file",
    13511351                config_file);
    13521352        log_to_screen(tmp);
     
    13541354        return (1);
    13551355    }
    1356     mr_asprintf(&tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
     1356    mr_asprintf(tempfile, "%s/mojo-jojo.blah", bkpinfo->tmpdir);
    13571357    if (does_file_exist(config_file)) {
    1358         mr_asprintf(&command, "grep -vE '^%s .*$' %s > %s",
     1358        mr_asprintf(command, "grep -vE '^%s .*$' %s > %s",
    13591359                label, config_file, tempfile);
    13601360        paranoid_system(command);
    13611361        mr_free(command);
    13621362    }
    1363     mr_asprintf(&command, "echo \"%s %s\" >> %s", label, value, tempfile);
     1363    mr_asprintf(command, "echo \"%s %s\" >> %s", label, value, tempfile);
    13641364    paranoid_system(command);
    13651365    mr_free(command);
    13661366
    1367     mr_asprintf(&command, "mv -f %s %s", tempfile, config_file);
     1367    mr_asprintf(command, "mv -f %s %s", tempfile, config_file);
    13681368    paranoid_system(command);
    13691369    mr_free(command);
     
    15361536
    15371537    if (g_magicdev_command && g_magicdev_command[0]) {
    1538         mr_asprintf(&tmp, "%s &", g_magicdev_command);
     1538        mr_asprintf(tmp, "%s &", g_magicdev_command);
    15391539        paranoid_system(tmp);
    15401540        mr_free(tmp);
  • branches/3.0/mondo/src/common/libmondo-verify.c

    r3180 r3185  
    333333                            bkpinfo->restore_path,
    334334                            biggiestruct.filename);
    335                 mr_asprintf(&mds, "echo \"%s/%s not found\" >> %s/biggies.changed",
     335                mr_asprintf(mds, "echo \"%s/%s not found\" >> %s/biggies.changed",
    336336                            bkpinfo->restore_path,
    337337                            biggiestruct.filename,
     
    981981    assert(bkpinfo != NULL);
    982982
    983     mr_asprintf(&fname, "%s1", bkpinfo->media_device);
     983    mr_asprintf(fname, "%s1", bkpinfo->media_device);
    984984    if (is_this_device_mounted(fname)) {
    985985        log_msg(1, "USB device mounted. Remounting it at the right place");
    986         mr_asprintf(&tmp, "umount %s", fname);
     986        mr_asprintf(tmp, "umount %s", fname);
    987987        run_program_and_log_output(tmp, FALSE);
    988988        paranoid_free(tmp);
     
    991991
    992992    log_msg(1, "Mounting USB device.");
    993     mr_asprintf(&mountpoint, "%s/usb", bkpinfo->tmpdir);
    994     mr_asprintf(&tmp, "mkdir -p %s", mountpoint);
     993    mr_asprintf(mountpoint, "%s/usb", bkpinfo->tmpdir);
     994    mr_asprintf(tmp, "mkdir -p %s", mountpoint);
    995995    run_program_and_log_output(tmp, FALSE);
    996996    paranoid_free(tmp);
    997997    /* Mindi always create one single parition on the USB dev */
    998     mr_asprintf(&tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);
     998    mr_asprintf(tmp, "mount %s1 %s", bkpinfo->media_device, mountpoint);
    999999    ret = run_program_and_log_output(tmp, FALSE);
    10001000    paranoid_free(tmp);
     
    10061006    sync();
    10071007    log_msg(2, "OK, I've mounted the USB Disk/Key\n");
    1008     mr_asprintf(&tmp, "%s/archives/NOT-THE-LAST", mountpoint);
     1008    mr_asprintf(tmp, "%s/archives/NOT-THE-LAST", mountpoint);
    10091009    if (!does_file_exist(tmp)) {
    10101010        log_msg
     
    10231023    verify_all_slices_on_CD(mountpoint);
    10241024
    1025     mr_asprintf(&tmp1, "umount -d %s", mountpoint);
     1025    mr_asprintf(tmp1, "umount -d %s", mountpoint);
    10261026#ifdef __FreeBSD__
    10271027    ret += system(tmp1);
     
    10321032#endif
    10331033    {
    1034         mr_asprintf(&tmp, "%s failed; unable to unmount USB device\n", tmp1);
     1034        mr_asprintf(tmp, "%s failed; unable to unmount USB device\n", tmp1);
    10351035        log_to_screen(tmp);
    10361036        paranoid_free(tmp);
  • branches/3.0/mondo/src/common/newt-specific.c

    r3154 r3185  
    296296char *tmp1 = NULL;
    297297
    298     mr_asprintf(&tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id);
     298    mr_asprintf(tmp,"ps %s | grep \" %s \" | grep -v \"grep\" | awk '{print %s;}'", ps_options, str , ps_proc_id);
    299299    run_program_and_log_output(tmp, TRUE);
    300300    if (strlen(tmp) > 0) {
    301         mr_asprintf(&tmp1,"kill `%s`", tmp);
     301        mr_asprintf(tmp1,"kill `%s`", tmp);
    302302        run_program_and_log_output(tmp1, TRUE);
    303303        paranoid_free(tmp1);
     
    434434        run_program_and_log_output("umount -d " MNT_CDROM, FALSE);
    435435        if (g_selfmounted_isodir) {
    436             mr_asprintf(&command, "umount -d %s", g_selfmounted_isodir);
     436            mr_asprintf(command, "umount -d %s", g_selfmounted_isodir);
    437437            run_program_and_log_output(command, 1);
    438438            paranoid_free(command);
    439             mr_asprintf(&command, "rmdir %s", g_selfmounted_isodir);
     439            mr_asprintf(command, "rmdir %s", g_selfmounted_isodir);
    440440            run_program_and_log_output(command, 1);
    441441            paranoid_free(command);
     
    456456            if (strstr(bkpinfo->tmpdir ,"mondo.tmp.") != NULL) {
    457457                log_msg(8,"erasing tempdir %s",bkpinfo->tmpdir);
    458                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->tmpdir);
     458                mr_asprintf(command, "rm -Rf %s", bkpinfo->tmpdir);
    459459                paranoid_system(command);
    460460                mr_free(command);
     
    465465            if (strstr(bkpinfo->scratchdir ,"mondo.scratch.") != NULL) {
    466466                log_msg(8,"erasing scratchdir %s",bkpinfo->scratchdir);
    467                 mr_asprintf(&command, "rm -Rf %s", bkpinfo->scratchdir);
     467                mr_asprintf(command, "rm -Rf %s", bkpinfo->scratchdir);
    468468                paranoid_system(command);
    469469                mr_free(command);
     
    515515        }
    516516        if (grep_for_me[0] != '\0') {
    517             mr_asprintf(&command, "grep '%s' %s | tail -n%d",
     517            mr_asprintf(command, "grep '%s' %s | tail -n%d",
    518518                    grep_for_me, filename, g_noof_log_lines);
    519519        } else {
    520             mr_asprintf(&command, "tail -n%d %s", g_noof_log_lines,
     520            mr_asprintf(command, "tail -n%d %s", g_noof_log_lines,
    521521                    filename);
    522522        }
     
    536536                    */
    537537                    if (!strncmp(err_log_lines[i], "root:", 5)) {
    538                         mr_asprintf(&tmp, "%s", err_log_lines[i] + 6);
     538                        mr_asprintf(tmp, "%s", err_log_lines[i] + 6);
    539539                        strncpy(err_log_lines[i], tmp, (size_t)MAX_NEWT_COMMENT_LEN);
    540540                        mr_free(tmp);
     
    10741074                    (long) time_remaining % 60);
    10751075            if (percentage < 3) {
    1076                 mr_asprintf(&pcline_str, " Working");
     1076                mr_asprintf(pcline_str, " Working");
    10771077                for (j = 0; j < g_mysterious_dot_counter; j++) {
    10781078                    mr_strcat(pcline_str, ".");
     
    10831083                mr_strcat(pcline_str, " %c", special_dot_char(g_mysterious_dot_counter));
    10841084            } else {
    1085                 mr_asprintf(&pcline_str, " %3d%% done              %3d%% to go",
     1085                mr_asprintf(pcline_str, " %3d%% done              %3d%% to go",
    10861086                        percentage, 100 - percentage);
    10871087            }
    10881088            if (g_text_mode) {
    1089                 mr_asprintf(&taskprogress, "TASK:  [");
     1089                mr_asprintf(taskprogress, "TASK:  [");
    10901090                for (i = 0; i < percentage; i += 5) {
    10911091                    mr_strcat(taskprogress, "*");
     
    12341234            printf("---progress-form---3--- %s\n", blurb3);
    12351235            printf("---progress-form---E---\n");
    1236             mr_asprintf(&taskprogress, "TASK:  [");
     1236            mr_asprintf(taskprogress, "TASK:  [");
    12371237            for (i = 0; i < percentage; i += 5) {
    12381238                mr_strcat(taskprogress, "*");
     
    14431443        newtPopWindow();
    14441444        if (b_res == b1) {
    1445             mr_asprintf(&output, "%s", "bzip2");
     1445            mr_asprintf(output, "%s", "bzip2");
    14461446        } else if (b_res == b2) {
    1447             mr_asprintf(&output, "%s", "gzip");
     1447            mr_asprintf(output, "%s", "gzip");
    14481448        } else if (b_res == b3) {
    1449             mr_asprintf(&output, "%s", "lzo");
     1449            mr_asprintf(output, "%s", "lzo");
    14501450        //} else if (b_res == b4) {
    1451             //mr_asprintf(&output, "%s", "lzma");
     1451            //mr_asprintf(output, "%s", "lzma");
    14521452        }
    14531453        newtPopHelpLine();
     
    15401540        }
    15411541
    1542         mr_asprintf(&tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
     1542        mr_asprintf(tmp1,"%s/icantfindthesefiles.txt",bkpinfo->tmpdir);
    15431543        if (!(fout = fopen(tmp1, "a"))) {
    15441544            log_msg(2, "Can't write to %s", tmp1);
     
    16371637        assert(flentry != NULL);
    16381638        if (flentry->severity == 0) {
    1639             mr_asprintf(&tmp, "0   ");
     1639            mr_asprintf(tmp, "0   ");
    16401640        } else if (flentry->severity == 1) {
    1641             mr_asprintf(&tmp, "low ");
     1641            mr_asprintf(tmp, "low ");
    16421642        } else if (flentry->severity == 2) {
    1643             mr_asprintf(&tmp, "med ");
    1644         } else {
    1645             mr_asprintf(&tmp, "high");
     1643            mr_asprintf(tmp, "med ");
     1644        } else {
     1645            mr_asprintf(tmp, "high");
    16461646        }
    16471647        mr_strcat(tmp, "  ");
  • branches/3.0/mondo/src/include/mr_mem.h

    r3128 r3185  
    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)
    22 #define mr_getline(x,y) mr_getline_int(x,y,__LINE__,__FILE__)
     21#define mr_asprintf(x,y,args...) mr_asprintf_int((char **)&x,__LINE__,__FILE__,y,## args)
     22#define mr_getline(x,y) mr_getline_int((char **)&x,y,__LINE__,__FILE__)
    2323#define mr_malloc(x) mr_malloc_int((size_t)x,__LINE__,__FILE__)
    2424#define mr_setenv(x,y) mr_setenv_int(x,y,__LINE__,__FILE__)
  • branches/3.0/mondo/src/lib/mr_conf.c

    r3060 r3185  
    107107    CONF = fopen(filename, "r");
    108108
    109     mr_asprintf(&mr_conf_filename, "%s", filename);
     109    mr_asprintf(mr_conf_filename, "%s", filename);
    110110
    111111    /*if file is empty or not exist => error */
     
    199199    p = mr_conf_read(field_name);
    200200    if (p != NULL) {
    201         mr_asprintf(&p1, "%d", p);
     201        mr_asprintf(p1, "%d", p);
    202202        }
    203203    return p1;
     
    211211    p = mr_conf_read(field_name);
    212212    if (p != NULL) {
    213         mr_asprintf(&p1, "%f", p);
     213        mr_asprintf(p1, "%f", p);
    214214    }
    215215    return p1;
     
    233233        return(p);
    234234    }
    235     mr_asprintf(&q, "%s", p);
     235    mr_asprintf(q, "%s", p);
    236236
    237237    if (*p != '"') {
     
    276276            (strncasecmp(p, "t" , (size_t)1) == 0) ||
    277277            (strncasecmp(p, "1" , (size_t)1) == 0)) {
    278             mr_asprintf(&p1, "%d", TRUE);
     278            mr_asprintf(p1, "%d", TRUE);
    279279        } else {
    280             mr_asprintf(&p1, "%d", FALSE);
     280            mr_asprintf(p1, "%d", FALSE);
    281281        }
    282282    }
     
    289289    char *p = NULL;
    290290
    291     mr_asprintf(&p, "%d", FALSE);
     291    mr_asprintf(p, "%d", FALSE);
    292292    if (strcmp(str,p) != 0) {
    293293        ret = TRUE;
  • branches/3.0/mondo/src/lib/mr_mem.c

    r3127 r3185  
    122122 */
    123123void mr_strcat_int(char **in, int line, const char *file, const char *fmt, ...) {
    124 
    125124    char *fmt2 = NULL;
    126125    va_list args;
  • branches/3.0/mondo/src/mondoarchive/mondoarchive.c

    r3141 r3185  
    206206
    207207    /* make sure PATH environmental variable allows access to mkfs, fdisk, etc. */
    208     mr_asprintf(&tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
     208    mr_asprintf(tmp1,"%s:/sbin:/usr/sbin:/usr/local/sbin",getenv("PATH"));
    209209    setenv("PATH", tmp1, 1);
    210210    paranoid_free(tmp1);
    211211
    212212    /* Add the ARCH environment variable for ia64 purposes */
    213     mr_asprintf(&tmp1,"%s",get_architecture());
     213    mr_asprintf(tmp1,"%s",get_architecture());
    214214    setenv("ARCH", tmp1, 1);
    215215    paranoid_free(tmp1);
     
    382382        retval += res;
    383383        if (res) {
    384             mr_asprintf(&say_at_end, "Data archived. Please check the logs, just as a precaution. ");
    385         } else {
    386             mr_asprintf(&say_at_end, "Data archived OK. ");
     384            mr_asprintf(say_at_end, "Data archived. Please check the logs, just as a precaution. ");
     385        } else {
     386            mr_asprintf(say_at_end, "Data archived OK. ");
    387387        }
    388388    }
     
    392392        res = verify_data();
    393393        if (res < 0) {
    394             mr_asprintf(&tmp, "%d difference%c found.", -res,
     394            mr_asprintf(tmp, "%d difference%c found.", -res,
    395395                    (-res != 1) ? 's' : ' ');
    396             mr_asprintf(&say_at_end, "%s", tmp);
     396            mr_asprintf(say_at_end, "%s", tmp);
    397397            log_to_screen(tmp);
    398398            mr_free(tmp);
     
    432432        paranoid_free(say_at_end);
    433433    }
    434     mr_asprintf(&tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
     434    mr_asprintf(tmp, "umount %s/tmpfs", bkpinfo->tmpdir);
    435435    run_program_and_log_output(tmp, TRUE);
    436436    mr_free(tmp);
    437437    if (bkpinfo->backup_media_type == usb) {
    438438        log_msg(1, "Unmounting USB device.");
    439         mr_asprintf(&tmp, "umount %s1", bkpinfo->media_device);
     439        mr_asprintf(tmp, "umount %s1", bkpinfo->media_device);
    440440        run_program_and_log_output(tmp, TRUE);
    441441        mr_free(tmp);
  • branches/3.0/mondo/src/mondorestore/mondo-prep.c

    r3071 r3185  
    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                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                free(tmp1);
     
    586586    // create device list from normal disks followed by spare ones
    587587    if (raidlist->el[i].data_disks.el[0].device != NULL) {
    588         mr_asprintf(&devices, "%s", raidlist->el[i].data_disks.el[0].device);
     588        mr_asprintf(devices, "%s", raidlist->el[i].data_disks.el[0].device);
    589589        log_msg(4, "Adding device %s to list", raidlist->el[i].data_disks.el[0].device);
    590590    } else {
     
    602602    // translate RAID level
    603603    if (raidlist->el[i].raid_level == -2) {
    604       mr_asprintf(&level, "multipath");
     604      mr_asprintf(level, "multipath");
    605605    } else if (raidlist->el[i].raid_level == -1) {
    606       mr_asprintf(&level, "linear");
     606      mr_asprintf(level, "linear");
    607607    } else {
    608       mr_asprintf(&level, "raid%d", raidlist->el[i].raid_level);
     608      mr_asprintf(level, "raid%d", raidlist->el[i].raid_level);
    609609    }
    610610    // create RAID device:
     
    614614    // - persistent superblock always used as this is recommended
    615615
    616     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);
     616    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);
    617617    mr_free(level);
    618618    log_msg(4, "cmd built: %s", program);
     
    718718
    719719    if (strstr(format, "raid")) {   // do not form RAID disks; do it to /dev/md* instead
    720         mr_asprintf(&tmp, "Not formatting %s (it is a RAID disk)", device);
     720        mr_asprintf(tmp, "Not formatting %s (it is a RAID disk)", device);
    721721        log_it(tmp);
    722722        paranoid_free(tmp);
     
    733733#endif
    734734    if (strlen(format) <= 2) {
    735         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);
     735        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);
    736736        log_it(tmp);
    737737        paranoid_free(tmp);
     
    740740    }
    741741    if (is_this_device_mounted(device)) {
    742         mr_asprintf(&tmp, "%s is mounted - cannot format it      ", device);
     742        mr_asprintf(tmp, "%s is mounted - cannot format it       ", device);
    743743        log_to_screen(tmp);
    744744        paranoid_free(tmp);
     
    771771            char line[MAX_STR_LEN];
    772772
    773             mr_asprintf(&tmp, "Initializing Vinum device %s (this may take a *long* time)", device);
     773            mr_asprintf(tmp, "Initializing Vinum device %s (this may take a *long* time)", device);
    774774            log_to_screen(tmp);
    775775            paranoid_free(tmp);
     
    789789                    *(strchr(line, '\n')) = '\0';   // get rid of the \n on the end
    790790
    791                 mr_asprintf(&tmp, "Initializing plex: %s", line);
     791                mr_asprintf(tmp, "Initializing plex: %s", line);
    792792                open_evalcall_form(tmp);
    793793                paranoid_free(tmp);
    794794
    795                 mr_asprintf(&tmp, "vinum init %s", line);
     795                mr_asprintf(tmp, "vinum init %s", line);
    796796                paranoid_system(tmp);
    797797                paranoid_free(tmp);
    798798
    799799                while (1) {
    800                     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);
     800                    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);
    801801                    FILE *pin = popen(tmp, "r");
    802802                    paranoid_free(tmp);
     
    820820        }
    821821#else
    822         mr_asprintf(&tmp, "Initializing RAID device %s", device);
     822        mr_asprintf(tmp, "Initializing RAID device %s", device);
    823823        log_to_screen(tmp);
    824824        paranoid_free(tmp);
     
    871871    }
    872872    res = which_format_command_do_i_need(format, program);
    873     mr_asprintf(&tmp, "%s %s", program, device);
     873    mr_asprintf(tmp, "%s %s", program, device);
    874874    if (strstr(program, "kludge")) {
    875875        mr_strcat(tmp, " /");
     
    878878    paranoid_free(tmp);
    879879
    880     mr_asprintf(&tmp, "Formatting %s as %s", device, format);
     880    mr_asprintf(tmp, "Formatting %s as %s", device, format);
    881881    update_progress_form(tmp);
    882882    paranoid_free(tmp);
     
    892892
    893893    if (res && strstr(program, "kludge")) {
    894         mr_asprintf(&tmp, "Kludge failed; using regular mkfs.%s to format %s",
     894        mr_asprintf(tmp, "Kludge failed; using regular mkfs.%s to format %s",
    895895                format, device);
    896896#ifdef __FreeBSD__
     
    17051705        paranoid_system(tmp);
    17061706        // mark relevant partition as bootable
    1707         mr_asprintf(&tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename);
     1707        mr_asprintf(tmp1,"make-me-bootable /tmp/mountlist.txt %s",drivename);
    17081708        call_program_and_get_last_line_of_output(tmp1);
    17091709        mr_free(tmp1);
     
    18171817    /* BERLIOS: should not be called each time */
    18181818    part_table_fmt = which_partition_format(drive);
    1819     mr_asprintf(&output, "");
     1819    mr_asprintf(output, "");
    18201820    /* make it a primary/extended/logical */
    18211821    if (partno <= 4) {
     
    21692169            fput_string_one_char_at_a_time(pout_to_fdisk, "p\n");
    21702170        } else {
    2171             mr_asprintf(&output, "t\n%d\n%s\nw\n", partno, partcode);
     2171            mr_asprintf(output, "t\n%d\n%s\nw\n", partno, partcode);
    21722172            sprintf(command, "parted2fdisk %s >> %s 2>> %s", drive,
    21732173                    MONDO_LOGFILE, MONDO_LOGFILE);
     
    25192519        return;
    25202520    }
    2521     mr_asprintf(&tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024);
     2521    mr_asprintf(tmp, "Expanding entries to suit drive %s (%lld MB)", drive_name, current_size_of_drive / 1024);
    25222522    log_to_screen(tmp);
    25232523    mr_free(tmp);
     
    25392539
    25402540    if (original_size_of_drive <= 0LL) {
    2541         mr_asprintf(&tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
     2541        mr_asprintf(tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
    25422542        log_to_screen(tmp);
    25432543        mr_free(tmp);
     
    25452545    }
    25462546    factor = ((float)current_size_of_drive/(float)original_size_of_drive);
    2547     mr_asprintf(&tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",
     2547    mr_asprintf(tmp, "Disk %s was %lld MB; is now %lld MB; Proportionally resizing partitions (factor ~= %.5f)",
    25482548            drive_name, original_size_of_drive/1024, current_size_of_drive/1024, factor);
    25492549    log_to_screen(tmp);
     
    25722572        totalsizL += newsizL;
    25732573
    2574         mr_asprintf(&tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
     2574        mr_asprintf(tmp, "Changing %s from %lld KB to %lld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
    25752575        log_to_screen(tmp);
    25762576        mr_free(tmp);
     
    25792579    // Ensures over-allocation alert and prompt for interactive mode does not happen
    25802580    if (totalsizL > current_size_of_drive) {
    2581         mr_asprintf(&tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive));
     2581        mr_asprintf(tmp, "Last partition size calculated would be over-allocated, reducing %s from %lld KB to %lld KB.", drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size - (totalsizL - current_size_of_drive));
    25822582        drivemntlist->el[drivemntlist->entries-1]->size -= (totalsizL - current_size_of_drive);
    25832583    } else if (totalsizL < current_size_of_drive) {
    2584         mr_asprintf(&tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL));
     2584        mr_asprintf(tmp, "Last partition size calculated would be under-allocated, increasing %s from %lld KB to %lld KB.",drivemntlist->el[lastpart]->device, drivemntlist->el[lastpart]->size, drivemntlist->el[lastpart]->size + (current_size_of_drive - totalsizL));
    25852585        drivemntlist->el[drivemntlist->entries-1]->size += (current_size_of_drive - totalsizL);
    25862586    }
    25872587    log_to_screen(tmp);
    25882588    mr_free(tmp);
    2589     mr_asprintf(&tmp, "final_size = %lld MB", current_size_of_drive / 1024);
     2589    mr_asprintf(tmp, "final_size = %lld MB", current_size_of_drive / 1024);
    25902590    log_to_screen(tmp);
    25912591    mr_free(tmp);
  • branches/3.0/mondo/src/mondorestore/mondo-rstr-compare.c

    r3060 r3185  
    8181            insist_on_this_cd_number((++g_current_media_number));
    8282        } else {
    83             mr_asprintf(&tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
     83            mr_asprintf(tmp_ptr, "No CD's left. No biggiefiles left. No prob, Bob.");
    8484            log_msg(2, tmp_ptr);
    8585            paranoid_free(tmp_ptr);
     
    8888    }
    8989    if (!(fin = fopen(slice_fname(bigfileno, 0, ARCHIVES_PATH, ""), "r"))) {
    90         mr_asprintf(&tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
     90        mr_asprintf(tmp_ptr, "Cannot open bigfile %ld (%s)'s info file", bigfileno + 1, bigfile_fname_ptr);
    9191        log_to_screen(tmp_ptr);
    9292        paranoid_free(tmp_ptr);
     
    105105
    106106    if (!g_text_mode) {
    107         mr_asprintf(&tmp_ptr, "Comparing %s", bigfile_fname_ptr);
     107        mr_asprintf(tmp_ptr, "Comparing %s", bigfile_fname_ptr);
    108108        newtDrawRootText(0, 22, tmp_ptr);
    109109        paranoid_free(tmp_ptr);
     
    121121    }
    122122    log_msg(2, command_ptr);
    123     mr_asprintf(&tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
     123    mr_asprintf(tmp_ptr, "cat /tmp/errors >> %s 2> /dev/null", MONDO_LOGFILE);
    124124    paranoid_system(tmp_ptr);
    125125    paranoid_free(tmp_ptr);
     
    149149        }
    150150    }
    151     mr_asprintf(&tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);
     151    mr_asprintf(tmp_ptr, "bigfile #%ld ('%s') ", bigfileno + 1, bigfile_fname_ptr);
    152152    if (!strcmp(checksum_ptr, original_cksum_ptr) != 0) {
    153153        mr_strcat(tmp_ptr, " ... OK");
     
    280280
    281281    if (use_star) {
    282         mr_asprintf(&archiver_exe, "star");
    283     } else {
    284         mr_asprintf(&archiver_exe, "afio");
     282        mr_asprintf(archiver_exe, "star");
     283    } else {
     284        mr_asprintf(archiver_exe, "afio");
    285285    }
    286286
  • branches/3.0/mondo/src/mondorestore/mondo-rstr-newt.c

    r3158 r3185  
    19741974        /* flaws_str can be NULL */
    19751975        if ((flaws_str == NULL) || (strlen(flaws_str) == 0)) {
    1976             mr_asprintf(&flaws_str_A, "");
     1976            mr_asprintf(flaws_str_A, "");
    19771977        } else {
    1978             mr_asprintf(&flaws_str_A, "%s", flaws_str + 1);
     1978            mr_asprintf(flaws_str_A, "%s", flaws_str + 1);
    19791979        }
    19801980        if (strlen(flaws_str_A) >= 74) {
    19811981            for (i = 74; flaws_str_A[i] != ' '; i--);
    1982             mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
     1982            mr_asprintf(flaws_str_B, "%s", flaws_str_A + i + 1);
    19831983            flaws_str_A[i] = '\0';
    19841984        } else {
    1985             mr_asprintf(&flaws_str_B, "");
     1985            mr_asprintf(flaws_str_B, "");
    19861986        }
    19871987        if (strlen(flaws_str_B) >= 74) {
    19881988            for (i = 74; flaws_str_B[i] != ' '; i--);
    1989             mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
     1989            mr_asprintf(flaws_str_C, "%s", flaws_str_B + i + 1);
    19901990            flaws_str_B[i] = '\0';
    19911991        } else {
    1992             mr_asprintf(&flaws_str_C, "");
     1992            mr_asprintf(flaws_str_C, "");
    19931993        }
    19941994
  • branches/3.0/mondo/src/mondorestore/mondo-rstr-tools.c

    r3158 r3185  
    330330                if (HDD) {
    331331                    /*  We need an additional param */
    332                     mr_asprintf(&(bkpinfo->subdir), "%s", bkpinfo->isodir);
     332                    mr_asprintf(bkpinfo->subdir, "%s", bkpinfo->isodir);
    333333                    strcpy(bkpinfo->isodir, "/tmp/isodir");
    334334                    log_it("Now bkpinfo->isodir = %s and subdir = ", bkpinfo->isodir, bkpinfo->subdir);
     
    383383    log_to_screen("WARNING - isodir is already mounted");
    384384} else {
    385     mr_asprintf(&mount_isodir_command, "mount %s", g_isodir_device);
     385    mr_asprintf(mount_isodir_command, "mount %s", g_isodir_device);
    386386    if (strlen(g_isodir_format) > 1) {
    387387        mr_strcat(mount_isodir_command, " -t %s", g_isodir_format);
     
    478478    log_msg(1, tmp);
    479479    /* Deal with additional params only if not /proc or /sys */
    480     mr_asprintf(&additional_parameters, "");
     480    mr_asprintf(additional_parameters, "");
    481481    if (strcmp(format, "proc") && strcmp(format, "sys")) {
    482482        if (writeable) {
     
    586586               "", mountlist->entries);
    587587
    588     mr_asprintf(&these_failed, "");
     588    mr_asprintf(these_failed, "");
    589589    for (lino = 0; lino < mountlist->entries; lino++) {
    590590        if (!strcmp(mountlist->el[lino].device, "/proc")) {
     
    766766    bkpinfo->please_dont_eject = TRUE;
    767767    if (read_cfg_var(cfg_file, "netfs-proto", value) == 0) {
    768         mr_asprintf(&(bkpinfo->netfs_proto),"%s", value);
     768        mr_asprintf(bkpinfo->netfs_proto,"%s", value);
    769769    } else {
    770770        /* For compatibility, force protocol in old nfs case to be transparent */
    771         mr_asprintf(&(bkpinfo->netfs_proto), "nfs");
     771        mr_asprintf(bkpinfo->netfs_proto, "nfs");
    772772    }
    773773    if (read_cfg_var(cfg_file, "netfs-server-user", value) == 0) {
    774         mr_asprintf(&(bkpinfo->netfs_user),"%s", value);
     774        mr_asprintf(bkpinfo->netfs_user,"%s", value);
    775775    }
    776776    if (read_cfg_var(cfg_file, "iso-prefix", value) == 0) {
     
    851851read_cfg_var(cfg_file, "acl", value);
    852852if (strstr(value, "TRUE")) {
    853     mr_asprintf(&g_getfacl,"setfacl");
     853    mr_asprintf(g_getfacl,"setfacl");
    854854    log_msg(1, "We will restore ACLs");
    855855    if (! find_home_of_exe("setfacl")) {
     
    859859read_cfg_var(cfg_file, "xattr", value);
    860860if (strstr(value, "TRUE")) {
    861     mr_asprintf(&g_getfattr,"setfattr");
     861    mr_asprintf(g_getfattr,"setfattr");
    862862    log_msg(1, "We will restore XATTRs");
    863863    if (! find_home_of_exe("setfattr")) {
     
    13701370     * the current /dev location
    13711371     */
    1372     mr_asprintf(&cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
     1372    mr_asprintf(cmd,"tar cf - /dev | ( cd %s ; tar xf - )",MNT_RESTORING);
    13731373    run_program_and_log_output(cmd, 3);
    13741374    paranoid_free(cmd);
     
    13851385    read_cfg_var(g_mondo_cfg_file, "bootloader.device", device);
    13861386    read_cfg_var(g_mondo_cfg_file, "bootloader.name", name);
    1387     mr_asprintf(&tmp, "run_boot_loader: device='%s', name='%s'", device, name);
     1387    mr_asprintf(tmp, "run_boot_loader: device='%s', name='%s'", device, name);
    13881388    log_msg(2, tmp);
    13891389    paranoid_free(tmp);
     
    14021402#ifdef __FreeBSD__
    14031403    else if (!strcmp(name, "BOOT0")) {
    1404         mr_asprintf(&tmp, "boot0cfg -B %s", device);
     1404        mr_asprintf(tmp, "boot0cfg -B %s", device);
    14051405        res = run_program_and_log_output(tmp, FALSE);
    14061406        paranoid_free(tmp);
    14071407    } else {
    1408         mr_asprintf(&tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
     1408        mr_asprintf(tmp, "ls /dev | grep -Eq '^%ss[1-4].*'", device);
    14091409        if (!system(tmp)) {
    14101410            paranoid_free(tmp);
    1411             mr_asprintf(&tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
     1411            mr_asprintf(tmp, MNT_RESTORING "/sbin/fdisk -B %s", device);
    14121412            res = run_program_and_log_output(tmp, 3);
    14131413        } else {
     
    20562056    paranoid_system("sync");
    20572057
    2058     mr_asprintf(&tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
     2058    mr_asprintf(tmp, "cp -f %s " MNT_RESTORING "/var/log", MONDO_LOGFILE);
    20592059    if (run_program_and_log_output(tmp, FALSE)) {
    20602060        log_msg(1,
     
    20752075            continue;
    20762076        }
    2077         mr_asprintf(&tmp, "Unmounting device %s  ", mountlist->el[lino].device);
     2077        mr_asprintf(tmp, "Unmounting device %s  ", mountlist->el[lino].device);
    20782078
    20792079        update_progress_form(tmp);
  • branches/3.0/mondo/src/mondorestore/mondorestore.c

    r3158 r3185  
    354354
    355355    /* Clean up blkid cache file if they exist */
    356     mr_asprintf(&tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
     356    mr_asprintf(tmp1,"%s/etc/blkid.tab",bkpinfo->restore_path);
    357357    (void)unlink(tmp1);
    358358    paranoid_free(tmp1);
    359     mr_asprintf(&tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
     359    mr_asprintf(tmp1,"%s/etc/blkid.tab.old",bkpinfo->restore_path);
    360360    (void)unlink(tmp1);
    361361    paranoid_free(tmp1);
     
    369369
    370370    /* Clean up multiconf cache file if they exist */
    371     mr_asprintf(&tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
     371    mr_asprintf(tmp1,"%s/var/lib/multipath/bindings",bkpinfo->restore_path);
    372372    (void)unlink(tmp1);
    373373    paranoid_free(tmp1);
    374374
    375375    /* Edit multipath.conf if needed to adapt wwid */
    376     mr_asprintf(&tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
     376    mr_asprintf(tmp1,"%s/etc/multipath.conf", MNT_RESTORING);
    377377    if (does_file_exist(tmp1)) {
    378378        log_msg(2, "We may need to clean /etc/multipath.conf");
     
    384384
    385385    if (bkpinfo->restore_mode != nuke) {
    386         mr_asprintf(&editor, "%s", find_my_editor());
    387         mr_asprintf(&tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
     386        mr_asprintf(editor, "%s", find_my_editor());
     387        mr_asprintf(tmp1,"chroot %s %s /etc/multipath.conf", MNT_RESTORING, editor);
    388388        popup_and_OK("You will now edit multipath.conf");
    389389        if (!g_text_mode) {
     
    16701670    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
    16711671//  sprintf(files_to_restore_this_time_fname, "/tmp/ftrttf.%d.%d", (int)getpid(), (int)random());
    1672     mr_asprintf(&command, "mkdir -p %s/tmp", MNT_RESTORING);
     1672    mr_asprintf(command, "mkdir -p %s/tmp", MNT_RESTORING);
    16731673    run_program_and_log_output(command, 9);
    16741674    paranoid_free(command);
     
    17571757//      if (strstr(tarball_fname, ".star."))
    17581758        if (use_star) {
    1759             mr_asprintf(&command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname);
     1759            mr_asprintf(command, "star -x -force-remove -sparse -U " STAR_ACL_SZ " file=%s", tarball_fname);
    17601760            if (strstr(tarball_fname, ".bz2")) {
    17611761                mr_strcat(command, " -bz");
     
    17631763        } else {
    17641764            if (filelist_subset_fname[0] != '\0') {
    1765                 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);
     1765                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);
    17661766            } else {
    1767                 mr_asprintf(&command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
     1767                mr_asprintf(command, "afio -i -b %ld -c %ld -M 8m %s %s", TAPE_BLOCK_SIZE, BUFSIZE, executable, tarball_fname);
    17681768            }
    17691769        }
     
    18181818        // Be verbose for star
    18191819        if (retval || use_star) {
    1820             mr_asprintf(&command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
     1820            mr_asprintf(command, "cat %s >> %s", temp_log, MONDO_LOGFILE);
    18211821            paranoid_system(command);
    18221822            paranoid_free(command);
     
    23102310                                              filelist);
    23112311            }
    2312             mr_asprintf(&tmp1, "%s #%d, fileset #%ld - restore ",
     2312            mr_asprintf(tmp1, "%s #%d, fileset #%ld - restore ",
    23132313                    mds, g_current_media_number, current_tarball_number);
    23142314            if (res) {
  • branches/3.0/mondo/test/test-mountlist.c

    r3158 r3185  
    5656char *flaws_str = NULL;
    5757
    58 mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
     58mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-mountlist.log");
    5959
    6060/* Globals */
     
    7272
    7373setup_newt_stuff();
    74 mr_asprintf(&g_mountlist_fname, MOUNTLIST_TEST);
     74mr_asprintf(g_mountlist_fname, MOUNTLIST_TEST);
    7575log_it("before mountlist");
    7676load_mountlist(mountlist, g_mountlist_fname);
  • branches/3.0/mondo/test/test-truncname.c

    r3158 r3185  
    6767int i;
    6868
    69 mr_asprintf(&MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
     69mr_asprintf(MONDO_LOGFILE,"/tmp/mrtest-truncname.log");
    7070
    7171/* Globals */
     
    7777for (i=0; list[i] != NULL; i++) {
    7878    log_it("%d: partition %s ...",i, list[i]);
    79     mr_asprintf(&part,"%s",list[i]);
     79    mr_asprintf(part,"%s",list[i]);
    8080    disk = truncate_to_drive_name(part);
    8181    log_it("...belongs to disk %s",disk);
Note: See TracChangeset for help on using the changeset viewer.