Changeset 2323 in MondoRescue for branches/2.2.10/mondo/src/mondorestore


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

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

  • Change mr_asprintf interface to pass only the char * (makes bkpinfo usage more easy)
Location:
branches/2.2.10/mondo/src/mondorestore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.10/mondo/src/mondorestore/mondo-prep.c

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

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

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

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

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