Changeset 2281 in MondoRescue


Ignore:
Timestamp:
Jul 20, 2009, 12:27:56 AM (15 years ago)
Author:
Bruno Cornec
Message:

r3276@localhost: bruno | 2009-07-20 00:14:55 +0200

  • Replace sprintf by mr_asprintf in mondo-prep.c and change interface of function which_format_command_do_i_need
Location:
branches/2.2.10/mondo/src/mondorestore
Files:
3 edited

Legend:

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

    r2230 r2281  
    6060void wipe_MBRs_and_reboot_if_necessary(struct mountlist_itself *mountlist)
    6161{
    62     char *command;
     62    char *command = NULL;
    6363    char *tmp;
    6464    int lino;
    6565    int i;
     66    int res = 0;
    6667    FILE *fout;
    6768    char *buf;
    6869    const int blocksize = 512;
    6970    struct list_of_disks *drivelist = NULL;
     71
    7072// If LVMs are present and a zero-and-reboot wasn't recently undertaken
    7173// then zero & insist on reboot.
    72     malloc_string(command);
    7374    malloc_string(tmp);
    7475    buf = malloc(blocksize);
     
    7879        make_list_of_drives_in_mountlist(mountlist, drivelist);
    7980        for (lino = 0; lino < drivelist->entries; lino++) {
    80             sprintf(command,
     81            mr_asprintf(&command,
    8182                    "dd if=%s bs=512 count=1 2> /dev/null | grep \"%s\"",
    8283                    drivelist->el[lino].device, MONDO_WAS_HERE);
    83             if (!run_program_and_log_output(command, 1)) {
     84            res = run_program_and_log_output(command, 1);
     85            mr_free(command);
     86            if (!res) {
    8487                log_msg(1, "Found MONDO_WAS_HERE marker on drive#%d (%s)",
    8588                        lino, drivelist->el[lino].device);
     
    126129    }
    127130// Still here? Cool!
    128     paranoid_free(command);
    129131    paranoid_free(tmp);
    130132    log_msg(1, "Cool. I didn't have to wipe anything.");
     
    236238    malloc_string(vgchange_sz);
    237239    malloc_string(vgremove_sz);
    238 //  malloc_string(do_this_last); // postpone lvcreate call if necessary
    239240    command = malloc(512);
    240241
    241 //  do_this_last[0] = '\0';
    242242    log_it("STARTING");
    243243    log_msg(1, "OK, opened i-want-my-lvm. Shutting down LVM volumes...");
     
    260260        strcpy(vgremove_sz, "vgremove");
    261261    }
    262     sprintf(command,
     262    mr_asprintf(&tmp1,
    263263            "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);
    264     run_program_and_log_output(command, 5);
     264    run_program_and_log_output(tmp1, 5);
     265    mr_free(tmp1);
     266
    265267    sleep(1);
    266268    sprintf(command,
     
    271273        log_msg(1, "Closed i-want-my-lvm. Finished erasing LVMs.");
    272274        retval = 0;
    273         goto end_of_i_want_my_lvm;
    274     }
     275    } else {
    275276
    276277    log_msg(1, "OK, rewound i-want-my-lvm. Doing funky stuff...");
     
    288289        }
    289290        if ((p = strstr(incoming, "vgcreate"))) {
    290 // include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
     291            // include next line(s) if they end in /dev (cos we've got a broken i-want-my-lvm)
    291292            for (fgets(tmp, MAX_STR_LEN - 1, fin); !feof(fin); fgets(tmp, MAX_STR_LEN - 1, fin)) {
    292293                if (tmp[0] == '#') {
     
    307308            *q = '\0';
    308309            log_msg(1, "Deleting old entries at /dev/%s", tmp);
    309 //             sprintf(command, "%s -f %s", vgremove_sz, tmp);
    310 //             run_program_and_log_output(command, 1);
    311             sprintf(command, "rm -Rf /dev/%s", tmp);
    312             run_program_and_log_output(command, 1);
     310            mr_asprintf(&tmp1, "rm -Rf /dev/%s", tmp);
     311            run_program_and_log_output(tmp1, 1);
     312            mr_free(tmp1);
     313
    313314            run_program_and_log_output(vgscan_sz, 1);
    314315            run_program_and_log_output(pvscan_sz, 1);
     
    339340                mr_asprintf(&tmp1, "tail -n5 %s | grep Insufficient | tail -n1", MONDO_LOGFILE);
    340341                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
    341                 free(tmp1);
     342                mr_free(tmp1);
    342343            } else {
    343344                mr_asprintf(&tmp1, "tail -n5 %s | grep lvcreate | tail -n1", MONDO_LOGFILE);
    344345                strcpy(tmp, call_program_and_get_last_line_of_output(tmp1));
    345                 free(tmp1);
     346                mr_free(tmp1);
    346347            }
    347348            for (p = tmp; *p != '\0' && !isdigit(*p); p++);
     
    395396            retval++;
    396397        }
    397         sprintf(tmp, "echo \"%s\" >> /tmp/out.sh", command);
    398         system(tmp);
     398        mr_asprintf(&tmp1, "echo \"%s\" >> /tmp/out.sh", command);
     399        system(tmp1);
     400        mr_free(tmp1);
    399401        sleep(1);
    400402    }
    401403    paranoid_fclose(fin);
    402404    log_msg(1, "Closed i-want-my-lvm. Finished doing funky stuff.");
    403   end_of_i_want_my_lvm:
     405    }
    404406    paranoid_free(tmp);
    405407    paranoid_free(incoming);
     
    412414    paranoid_free(vgchange_sz);
    413415    paranoid_free(vgremove_sz);
    414 //  paranoid_free(do_this_last);
    415416    system("sync");
    416417    system("sync");
     
    450451    /** buffers **********************************************************/
    451452    char *incoming;
    452     char *tmp;
     453    char *tmp = NULL;
    453454
    454455    /** pointers *********************************************************/
     
    461462
    462463    malloc_string(incoming);
    463     malloc_string(tmp);
    464464    assert(new_mountlist != NULL);
    465465    assert(old_mountlist != NULL);
     
    487487                 fgets(incoming, MAX_STR_LEN - 1, fin));
    488488            if (!feof(fin)) {
    489                 sprintf(tmp, "Investigating %s",
    490                         old_mountlist->el[lino].device);
     489                mr_asprintf(&tmp, "Investigating %s", old_mountlist->el[lino].device);
    491490                log_it(tmp);
     491                mr_free(tmp);
     492
    492493                for (fgets(incoming, MAX_STR_LEN - 1, fin); !feof(fin)
    493494                     && !strstr(incoming, "raiddev");
     
    499500                        *p = '\0';
    500501                        for (p--; p > incoming && *(p - 1) > 32; p--);
    501                         sprintf(tmp, "Extrapolating %s", p);
     502                        mr_asprintf(&tmp, "Extrapolating %s", p);
    502503                        log_it(tmp);
     504                        mr_free(tmp);
     505
    503506                        for (j = 0;
    504507                             j < new_mountlist->entries
     
    518521                            new_mountlist->entries++;
    519522                        } else {
    520                             sprintf(tmp,
     523                            mr_asprintf(&tmp,
    521524                                    "Not adding %s to mountlist: it's already there",
    522525                                    p);
    523526                            log_it(tmp);
     527                            mr_free(tmp);
    524528                        }
    525529                    }
     
    540544    }
    541545    paranoid_free(incoming);
    542     paranoid_free(tmp);
    543546
    544547    return (0);
     
    683686
    684687    /** buffers ***********************************************************/
    685     char *program;
     688    char *program = NULL;
    686689    char *tmp = NULL;
    687690    int res = 0;
     
    690693    /** end ****************************************************************/
    691694
    692     malloc_string(program);
    693695    assert_string_is_neither_NULL_nor_zerolength(device);
    694696    assert(format != NULL);
     
    698700        log_it(tmp);
    699701        paranoid_free(tmp);
    700         paranoid_free(program);
    701702        return (0);
    702703    }
     
    704705    if (strcmp(format, "swap") == 0) {
    705706        log_it("Not formatting %s - it's swap", device);
    706         paranoid_free(program);
    707         paranoid_free(tmp);
    708707        return (0);
    709708    }
     
    715714        log_it(tmp);
    716715        paranoid_free(tmp);
    717         paranoid_free(program);
    718716        return (0);
    719717    }
     
    722720        log_to_screen(tmp);
    723721        paranoid_free(tmp);
    724         paranoid_free(program);
    725722        return (1);
    726723    }
     
    755752
    756753            /* format raid partition */
    757             //      sprintf (program, "mkraid --really-force %s", device); --- disabled -- BB, 02/12/2003
    758             sprintf(program,
    759                     "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes",
    760                     basename(device));
     754            mr_asprintf(&program,
     755                    "for plex in `vinum lv -r %s | grep '^P' | tr '\t' ' ' | tr -s ' ' | cut -d' ' -f2`; do echo $plex; done > /tmp/plexes", basename(device));
    761756            system(program);
    762757            if (g_fprep) {
    763758                fprintf(g_fprep, "%s\n", program);
    764759            }
     760            mr_free(program);
     761
    765762            fin = fopen("/tmp/plexes", "r");
    766763            while (fgets(line, MAX_STR_LEN - 1, fin)) {
     
    809806        system("sync");
    810807        sleep(1);
    811         if (g_fprep) {
    812             fprintf(g_fprep, "%s\n", program);
    813         }
    814808
    815809        log_msg(1, "Making %s", device);
     
    819813            log_msg(1, "Creating RAID device %s via mdadm returned %d", device, res);
    820814        } else {
    821             sprintf(program, "mkraid --really-force %s", device);
     815            mr_asprintf(&program, "mkraid --really-force %s", device);
    822816            res = run_program_and_log_output(program, 1);
    823817            log_msg(1, "%s returned %d", program, res);
     
    828822                fprintf(g_fprep, "%s\n", program);
    829823            }
     824            mr_free(program);
    830825        }
    831826        system("sync");
    832827        sleep(2);
    833 //      log_to_screen("Starting %s", device);
    834 //      sprintf(program, "raidstart %s", device);
    835 //      res = run_program_and_log_output(program, 1);
    836 //      log_msg(1, "%s returned %d", program, res);
    837 //      system("sync"); sleep(1);
    838828#endif
    839829        system("sync");
     
    841831        newtResume();
    842832    }
    843 //#ifndef __FreeBSD__
    844 //#endif
    845833
    846834    if (!strcmp(format, "lvm")) {
    847835        log_msg(1, "Don't format %s - it's part of an lvm volume", device);
    848         paranoid_free(program);
    849836        paranoid_free(tmp);
    850837        return (0);
    851838    }
    852     res = which_format_command_do_i_need(format, program);
     839    program = which_format_command_do_i_need(format);
    853840    mr_asprintf(&tmp, "%s %s", program, device);
    854841    if (strstr(program, "kludge")) {
    855842        mr_strcat(tmp, " /");
    856843    }
    857     sprintf(program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);
     844    mr_free(program);
     845
     846    mr_asprintf(&program, "sh -c 'echo -en \"y\\ny\\ny\\n\" | %s'", tmp);
    858847    paranoid_free(tmp);
    859848
     
    867856        mr_strcat(tmp, "Kludge failed; using regular mkfs.%s to format %s",
    868857                format, device);
     858        mr_free(program);
    869859#ifdef __FreeBSD__
    870         sprintf(program, "newfs_msdos -F 32 %s", device);
     860        mr_asprintf(&program, "newfs_msdos -F 32 %s", device);
    871861#else
    872862#ifdef __IA64__
    873863        /* For EFI partitions take fat16
    874864         * as we want to make small ones */
    875         sprintf(program, "mkfs -t %s -F 16 %s", format, device);
     865        mr_asprintf(&program, "mkfs -t %s -F 16 %s", format, device);
    876866#else
    877         sprintf(program, "mkfs -t %s -F 32 %s", format, device);
     867        mr_asprintf(&program, "mkfs -t %s -F 32 %s", format, device);
    878868#endif
    879869#endif
     
    883873        }
    884874    }
     875    mr_free(program);
    885876    retval += res;
    886877    if (retval) {
     
    891882
    892883    log_to_screen(tmp);
    893     paranoid_free(tmp);
    894 
    895     paranoid_free(program);
     884    mr_free(tmp);
     885
    896886    system("sync");
    897887    sleep(1);
     
    916906    int lino;
    917907    int res;
    918 //  int i;
    919 //  struct list_of_disks *drivelist;
    920908
    921909    /** long *************************************************************/
     
    926914
    927915    /** buffers **********************************************************/
    928     char *tmp;
     916    char *tmp = NULL;
    929917
    930918    /** pointers *********************************************************/
     
    933921
    934922    assert(mountlist != NULL);
    935     malloc_string(tmp);
    936     sprintf(tmp, "format_everything (mountlist, interactively = %s",
     923    Mr_asprintf(&tmp, "format_everything (mountlist, interactively = %s",
    937924            (interactively) ? "true" : "false");
    938925    log_it(tmp);
     926    mr_free(tmp);
     927
    939928    mvaddstr_and_log_it(g_currentY, 0, "Formatting partitions     ");
    940929    open_progress_form("Formatting partitions",
     
    946935        (mountlist->entries >
    947936         0) ? g_maximum_progress / mountlist->entries : 1;
    948 // start soft-raids now (because LVM might depend on them)
    949 // ...and for simplicity's sake, let's format them at the same time :)
     937        // start soft-raids now (because LVM might depend on them)
     938        // ...and for simplicity's sake, let's format them at the same time :)
    950939    log_msg(1, "Stopping all RAID devices");
    951940    stop_all_raid_devices(mountlist);
     
    961950            if (interactively) {
    962951                // ask user if we should format the current device
    963                 sprintf(tmp, "Shall I format %s (%s) ?", me->device,
     952                mr_asprintf(&tmp, "Shall I format %s (%s) ?", me->device,
    964953                        me->mountpoint);
    965954                do_it = ask_me_yes_or_no(tmp);
     955                mr_free(tmp);
    966956            } else {
    967957                do_it = TRUE;
     
    991981            newtSuspend();
    992982        }
    993 /*
    994         for(i=0; i<3; i++)
    995           {
    996             res = do_my_funky_lvm_stuff(FALSE, FALSE);
    997             if (!res) { break; }
    998             sleep(3);
    999             res = do_my_funky_lvm_stuff(TRUE, FALSE);
    1000             sleep(3);
    1001           }
    1002         if (res) {
    1003             log_msg(1, "Vacuum-packing...");
    1004 */
    1005983        res = do_my_funky_lvm_stuff(FALSE, TRUE);
    1006 /*
    1007         }
    1008 */
    1009984        if (!g_text_mode) {
    1010985            newtResume();
     
    1015990            log_to_screen("Failed to initialize LVM");
    1016991        }
    1017         // retval += res;
    1018992        if (res) {
    1019993            retval++;
     
    1021995        sleep(3);
    1022996    }
    1023 // do regulars at last
     997    // do regulars at last
    1024998    sleep(2);                   // woo!
    1025999    log_msg(1, "Formatting regulars");
     
    10271001        me = &mountlist->el[lino];  // the current mountlist entry
    10281002        if (!strcmp(me->mountpoint, "image")) {
    1029             sprintf(tmp, "Not formatting %s - it's an image", me->device);
     1003            mr_asprintf(&tmp, "Not formatting %s - it's an image", me->device);
    10301004            log_it(tmp);
     1005            mr_free(tmp);
    10311006        } else if (!strcmp(me->format, "raid")) {
    1032             sprintf(tmp, "Not formatting %s - it's a raid-let",
    1033                     me->device);
     1007            mr_asprintf(&tmp, "Not formatting %s - it's a raid-let", me->device);
    10341008            log_it(tmp);
     1009            mr_free(tmp);
    10351010            continue;
    10361011        } else if (!strcmp(me->format, "lvm")) {
    1037             sprintf(tmp, "Not formatting %s - it's an LVM", me->device);
     1012            mr_asprintf(&tmp, "Not formatting %s - it's an LVM", me->device);
    10381013            log_it(tmp);
     1014            mr_free(tmp);
    10391015            continue;
    10401016        } else if (!strncmp(me->device, "/dev/md", 7)) {
    1041             sprintf(tmp, "Already formatted %s - it's a soft-RAID dev",
    1042                     me->device);
     1017            mr_asprintf(&tmp, "Already formatted %s - it's a soft-RAID dev", me->device);
    10431018            log_it(tmp);
     1019            mr_free(tmp);
    10441020            continue;
    10451021        } else if (!does_file_exist(me->device)
    10461022                   && strncmp(me->device, "/dev/hd", 7)
    10471023                   && strncmp(me->device, "/dev/sd", 7)) {
    1048             sprintf(tmp,
    1049                     "Not formatting %s yet - doesn't exist - probably an LVM",
    1050                     me->device);
     1024            mr_asprintf(&tmp, "Not formatting %s yet - doesn't exist - probably an LVM", me->device);
    10511025            log_it(tmp);
     1026            mr_free(tmp);
    10521027            continue;
    10531028        } else {
    10541029            if (interactively) {
    10551030                // ask user if we should format the current device
    1056                 sprintf(tmp, "Shall I format %s (%s) ?", me->device,
    1057                         me->mountpoint);
     1031                mr_asprintf(&tmp, "Shall I format %s (%s) ?", me->device, me->mountpoint);
    10581032                do_it = ask_me_yes_or_no(tmp);
     1033                mr_free(tmp);
    10591034            } else {
    10601035                do_it = TRUE;
     
    10851060    }
    10861061
    1087     sprintf(tmp, "format_everything () - %s",
    1088             (retval) ? "failed!" : "finished successfully");
     1062    mr_asprintf(&tmp, "format_everything () - %s", (retval) ? "failed!" : "finished successfully");
    10891063    log_it(tmp);
     1064    mr_free(tmp);
    10901065
    10911066    if (g_partition_table_locked_up > 0) {
     
    11191094    system("clear");
    11201095    newtResume();
    1121     paranoid_free(tmp);
    11221096    return (retval);
    11231097}
     
    11421116
    11431117    /** buffers **********************************************************/
    1144     char *tmp;
     1118    char *tmp = NULL;
    11451119
    11461120    /** end **************************************************************/
    11471121
    1148     malloc_string(tmp);
    11491122    assert_string_is_neither_NULL_nor_zerolength(drivename);
    11501123
    11511124    if (devno_we_must_allow_for >= 5) {
    1152         sprintf(tmp, "Making dummy primary 1 on %s", drivename);
     1125        mr_asprintf(&tmp, "Making dummy primary 1 on %s", drivename);
    11531126        log_it(tmp);
     1127        mr_free(tmp);
     1128
    11541129        g_maximum_progress++;
    11551130        res =
     
    11641139    }
    11651140    for (; current_devno < devno_we_must_allow_for; current_devno++) {
    1166         sprintf(tmp, "Creating dummy partition %d on %s", current_devno, drivename);
     1141        mr_asprintf(&tmp, "Creating dummy partition %d on %s", current_devno, drivename);
    11671142        log_it(tmp);
     1143        mr_free(tmp);
    11681144        g_maximum_progress++;
    11691145        res =
     
    11731149        previous_devno = current_devno;
    11741150    }
    1175     paranoid_free(tmp);
    11761151    return (previous_devno);
    11771152}
     
    13861361                         char *drivename, struct disklabel *ret)
    13871362{
    1388     char subdev_str[MAX_STR_LEN];
    1389     char command[MAX_STR_LEN];
     1363    char *subdev_str = NULL
     1364    char *command = NULL;
    13901365    struct disklabel *lp;
    13911366    int i, lo = 0;
     
    13971372    for (c = 'a'; c <= 'z'; ++c) {
    13981373        int idx;
    1399         sprintf(subdev_str, "%s%c", drivename, c);
     1374        mr_asprintf(&subdev_str, "%s%c", drivename, c);
    14001375        if ((idx = find_device_in_mountlist(mountlist, subdev_str)) < 0) {
    14011376            lp->d_partitions[c - 'a'].p_size = 0;
     
    14221397                lp->d_partitions[c - 'a'].p_fstype = FS_OTHER;
    14231398        }
     1399        mr_free(subdev_str);
    14241400    }
    14251401
     
    14521428    display_disklabel(ftmp, lp);
    14531429    fclose(ftmp);
    1454     sprintf(command, "disklabel -wr %s auto", canonical_name(drivename));
     1430    mr_asprintf(&command, "disklabel -wr %s auto", canonical_name(drivename));
    14551431    retval += run_program_and_log_output(command, TRUE);
    1456     sprintf(command, "disklabel -R %s /tmp/disklabel",
     1432    mr_free(command);
     1433
     1434    mr_asprintf(&command, "disklabel -R %s /tmp/disklabel",
    14571435            canonical_name(drivename));
    14581436    retval += run_program_and_log_output(command, TRUE);
     1437    mr_free(command);
    14591438    if (ret)
    14601439        *ret = *lp;
     
    14821461#ifdef __FreeBSD__
    14831462    bool fbsd_part = FALSE;
    1484     char subdev_str[MAX_STR_LEN];
     1463    char *subdev_str = NULL;
     1464    char *command = NULL;
     1465    int r = 0;
    14851466#endif
    14861467
     
    14911472    char *device_str;
    14921473    char *format;
    1493     char *tmp;
     1474    char *tmp = NULL;
    14941475
    14951476    /** end *************************************************************/
     
    15001481    malloc_string(device_str);
    15011482    malloc_string(format);
    1502     malloc_string(tmp);
    1503 
    1504     sprintf(tmp, "Partitioning drive %s", drivename);
     1483
     1484    mr_asprintf(&tmp, "Partitioning drive %s", drivename);
    15051485    log_it(tmp);
     1486    mr_free(tmp);
    15061487
    15071488#if __FreeBSD__
     
    15101491#else
    15111492    make_hole_for_file(FDISK_LOG);
    1512     sprintf(tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
     1493    mr_asprintf(&tmp, "parted2fdisk %s >> %s 2>> %s", drivename, FDISK_LOG, FDISK_LOG);
    15131494    pout_to_fdisk = popen(tmp, "w");
     1495    mr_free(tmp);
    15141496    if (!pout_to_fdisk) {
    15151497        log_to_screen("Cannot call parted2fdisk to configure %s", drivename);
    15161498        paranoid_free(device_str);
    15171499        paranoid_free(format);
    1518         paranoid_free(tmp);
    15191500        return (1);
    15201501    }
     
    15341515                // try DangerouslyDedicated mode
    15351516                for (c = 'a'; c <= 'z'; c++) {
    1536                     sprintf(subdev_str, "%s%c", drivename, c);
    1537                     if (find_device_in_mountlist(mountlist, subdev_str) >
    1538                         0) {
     1517                    mr_asprintf(&subdev_str, "%s%c", drivename, c);
     1518                    if (find_device_in_mountlist(mountlist, subdev_str) > 0) {
    15391519                        fbsd_part = TRUE;
    15401520                    }
     1521                    mr_free(subdev_str);
    15411522                }
    15421523                if (fbsd_part) {
    1543                     int r = label_drive_or_slice(mountlist,
     1524                    r = label_drive_or_slice(mountlist,
    15441525                                                 drivename,
    15451526                                                 0);
    1546                     char command[MAX_STR_LEN];
    1547                     sprintf(command, "disklabel -B %s",
    1548                             basename(drivename));
     1527                    mr_asprintf(&command, "disklabel -B %s", basename(drivename));
    15491528                    if (system(command)) {
    15501529                        log_to_screen
    15511530                            ("Warning! Unable to make the drive bootable.");
    15521531                    }
     1532                    mr_free(command);
    15531533                    paranoid_free(device_str);
    15541534                    paranoid_free(format);
    1555                     paranoid_free(tmp);
    15561535                    return r;
    15571536                }
    15581537            }
    15591538            for (c = 'a'; c <= 'z'; c++) {
    1560                 sprintf(subdev_str, "%s%c", device_str, c);
     1539                mr_asprintf(&subdev_str, "%s%c", device_str, c);
    15611540                if (find_device_in_mountlist(mountlist, subdev_str) > 0) {
    15621541                    fbsd_part = TRUE;
    15631542                }
     1543                    mr_free(subdev_str);
    15641544            }
    15651545            // Now we check the subpartitions of the current partition.
     
    15701550                partsize = 0;
    15711551                for (i = 'a'; i < 'z'; ++i) {
    1572                     sprintf(subdev_str, "%s%c", device_str, i);
     1552                    mr_asprintf(&subdev_str, "%s%c", device_str, i);
    15731553                    line = find_device_in_mountlist(mountlist, subdev_str);
     1554                    mr_free(subdev_str);
     1555
    15741556                    if (line > 0) {
    15751557                        // We found one! Add its size to the total size.
     
    15941576#if __FreeBSD__
    15951577            // FreeBSD doesn't let you write to blk devices in <512byte chunks.
    1596 //          sprintf(tmp, "dd if=/dev/zero of=%s count=1 bs=512", drivename);
    1597 //          if (run_program_and_log_output(tmp, TRUE)) {
    15981578            file = open(drivename, O_WRONLY);
    15991579            if (file != -1) {
    1600                 sprintf(tmp,
     1580                mr_asprintf(&tmp,
    16011581                        "Warning - unable to open %s for wiping it's partition table",
    16021582                        drivename);
    16031583                log_to_screen(tmp);
     1584                mr_free(tmp);
    16041585            }
    16051586
    16061587            for (i = 0; i < 512; i++) {
    16071588                if (!write(file, "\0", 1)) {
    1608                     sprintf(tmp, "Warning - unable to write to %s",
     1589                    mr_asprintf(&tmp, "Warning - unable to write to %s",
    16091590                            drivename);
    16101591                    log_to_screen(tmp);
     1592                    mr_free(tmp);
    16111593                }
    16121594            }
     
    16181600                fflush(pout_to_fdisk);
    16191601            }
    1620 //          sprintf(tmp, "dd if=/dev/zero of=%s count=1 bs=512", drivename);
    1621 //          run_program_and_log_output(tmp, 1);
    16221602#endif
    16231603            if (current_devno > 1) {
     
    16441624            paranoid_free(device_str);
    16451625            paranoid_free(format);
    1646             paranoid_free(tmp);
    16471626            return (1);
    16481627        }
     
    16551634#ifdef __FreeBSD__
    16561635        if ((current_devno <= 4) && fbsd_part) {
    1657             sprintf(tmp, "disklabel -B %s", basename(device_str));
     1636            mr_asprintf(&tmp, "disklabel -B %s", basename(device_str));
    16581637            retval += label_drive_or_slice(mountlist, device_str, 0);
    16591638            if (system(tmp)) {
     
    16611640                    ("Warning! Unable to make the slice bootable.");
    16621641            }
     1642            mr_free(tmp);
    16631643        }
    16641644#endif
     
    16691649    if (pout_to_fdisk) {
    16701650// mark relevant partition as bootable
    1671         sprintf(tmp, "a\n%s\n",
     1651        mr_asprintf(&tmp, "a\n%s\n",
    16721652                call_program_and_get_last_line_of_output
    16731653                ("make-me-bootable /tmp/mountlist.txt dummy"));
    16741654        fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
     1655        mr_free(tmp);
     1656
    16751657// close fdisk
    16761658        fput_string_one_char_at_a_time(pout_to_fdisk, "w\n");
     
    16791661        log_msg(0,
    16801662                "------------------- fdisk.log looks like this ------------------");
    1681         sprintf(tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
     1663        mr_asprintf(&tmp, "cat %s >> %s", FDISK_LOG, MONDO_LOGFILE);
    16821664        system(tmp);
     1665        mr_free(tmp);
     1666
    16831667        log_msg(0,
    16841668                "------------------- end of fdisk.log... word! ------------------");
    1685         sprintf(tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
     1669        mr_asprintf(&tmp, "tail -n6 %s | grep -F \"16: \"", FDISK_LOG);
    16861670        if (!run_program_and_log_output(tmp, 5)) {
    16871671            g_partition_table_locked_up++;
    16881672        }
    1689         sprintf(tmp, "partprobe %s", drivename);
     1673        mr_free(tmp);
     1674
     1675        mr_asprintf(&tmp, "partprobe %s", drivename);
    16901676        if (!run_program_and_log_output(tmp, 5)) {
    16911677            g_partition_table_locked_up--;
    16921678        }
     1679        mr_free(tmp);
     1680
    16931681        if (g_partition_table_locked_up > 0) {
    16941682            log_to_screen
     
    16981686    paranoid_free(device_str);
    16991687    paranoid_free(format);
    1700     paranoid_free(tmp);
    17011688    return (retval);
    17021689}
     
    17201707
    17211708    /** buffers **********************************************************/
    1722     char *program;
     1709    char *program = NULL;
    17231710    char *partition_name;
    1724     char *tmp;
    1725     char *logfile;
     1711    char *tmp = NULL;
    17261712    char *output = NULL;
    17271713
     
    17331719    /** end ***************************************************************/
    17341720
    1735     malloc_string(program);
    17361721    malloc_string(partition_name);
    1737     malloc_string(tmp);
    1738     malloc_string(logfile);
    17391722
    17401723    assert_string_is_neither_NULL_nor_zerolength(drive);
     
    17451728
    17461729    if (!strncmp(drive, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))) {
    1747         sprintf(tmp, "Not partitioning %s - it is a virtual drive", drive);
     1730        mr_asprintf(&tmp, "Not partitioning %s - it is a virtual drive", drive);
    17481731        log_it(tmp);
    1749         paranoid_free(program);
     1732        mr_free(tmp);
     1733
    17501734        paranoid_free(partition_name);
    1751         paranoid_free(tmp);
    1752         paranoid_free(logfile);
    17531735        return (0);
    17541736    }
    17551737    build_partition_name(partition_name, drive, partno);
    17561738    if (partsize <= 0) {
    1757         sprintf(tmp, "Partitioning device %s (max size)", partition_name);
     1739        mr_asprintf(&tmp, "Partitioning device %s (max size)", partition_name);
    17581740    } else {
    1759         sprintf(tmp, "Partitioning device %s (%lld MB)", partition_name,
    1760                 (long long) partsize / 1024);
     1741        mr_asprintf(&tmp, "Partitioning device %s (%lld MB)", partition_name, (long long) partsize / 1024);
    17611742    }
    17621743    update_progress_form(tmp);
    17631744    log_it(tmp);
     1745    mr_free(tmp);
    17641746
    17651747    if (is_this_device_mounted(partition_name)) {
    1766         sprintf(tmp, "%s is mounted, and should not be partitioned",
     1748        mr_asprintf(&tmp, "%s is mounted, and should not be partitioned",
    17671749                partition_name);
    17681750        log_to_screen(tmp);
    1769         paranoid_free(program);
     1751        mr_free(tmp);
    17701752        paranoid_free(partition_name);
    1771         paranoid_free(tmp);
    1772         paranoid_free(logfile);
    17731753        return (1);
    1774 /*
    1775     } else if (does_partition_exist(drive, partno)) {
    1776         sprintf(tmp, "%s already has a partition", partition_name);
    1777         log_to_screen(tmp);
    1778         return (1);
    1779 */
    1780     }
    1781 
    1782 
    1783     /*  sprintf(tmp,"Partitioning %s  ",partition_name); */
    1784     /*  mvaddstr_and_log_it(g_currentY+1,30,tmp); */
     1754    }
     1755
     1756
    17851757    p = (char *) strrchr(partition_name, '/');
    1786     sprintf(logfile, "/tmp/fdisk.log.%s", ++p);
    1787     sprintf(program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE,
    1788             MONDO_LOGFILE);
    17891758
    17901759    /* BERLIOS: should not be called each time */
     
    18011770                    log_to_screen
    18021771                        ("You need to leave at least one partition free, for 'extended/logical'");
    1803                     paranoid_free(program);
    18041772                    paranoid_free(partition_name);
    1805                     paranoid_free(tmp);
    1806                     paranoid_free(logfile);
    18071773                    paranoid_free(output);
    18081774                    return (1);
     
    18261792    }
    18271793    mr_strcat(output, "\n");
    1828 #if 0
    1829 /*
    1830 #endif
    1831     sprintf(tmp,"PARTSIZE = +%ld",(long)partsize);
     1794    mr_asprintf(&tmp,"PARTSIZE = +%ld",(long)partsize);
    18321795    log_it(tmp);
     1796    mr_free(tmp);
    18331797    log_it("---fdisk command---");
    18341798    log_it(output);
    18351799    log_it("---end of fdisk---");
    1836 #if 0
    1837 */
    1838 #endif
    1839 
    1840 
     1800
     1801    mr_asprintf(&program, "parted2fdisk %s >> %s 2>> %s", drive, MONDO_LOGFILE, MONDO_LOGFILE);
    18411802    if (pout_to_fdisk) {
    18421803        log_msg(1, "Doing the new all-in-one fdisk thing");
     
    18441805        fput_string_one_char_at_a_time(pout_to_fdisk, output);
    18451806        fput_string_one_char_at_a_time(pout_to_fdisk, "\n\np\n");
    1846         strcpy(tmp, last_line_of_file(FDISK_LOG));
     1807        mr_asprintf(&tmp, "%s", last_line_of_file(FDISK_LOG));
    18471808        if (strstr(tmp, " (m ")) {
    18481809            log_msg(1, "Successfully created partition %d on %s", partno, drive);
     
    18511812            log_msg(1, "Failed to create partition %d on %s; sending 'Enter'...", partno, drive);
    18521813        }
     1814        mr_free(tmp);
     1815
    18531816        if (!retval) {
    18541817            log_msg(1, "Trying to set partition %d type now on %s", partno, drive);
     
    18851848                                 format, -1);
    18861849            if (res) {
    1887                 sprintf(tmp, "Failed to vacuum-pack %s", partition_name);
     1850                mr_asprintf(&tmp, "Failed to vacuum-pack %s", partition_name);
    18881851                log_it(tmp);
     1852                mr_free(tmp);
     1853
    18891854                retval++;
    18901855            } else {
     
    18971862                                   partsize);
    18981863            if (retval) {
    1899                 sprintf(tmp, "Partitioned %s but failed to set its type",
    1900                         partition_name);
     1864                mr_asprintf(&tmp, "Partitioned %s but failed to set its type", partition_name);
    19011865                log_it(tmp);
     1866                mr_free(tmp);
    19021867            } else {
    19031868                if (partsize > 0) {
    1904                     sprintf(tmp, "Partition %s created+configured OK",
    1905                             partition_name);
     1869                    mr_asprintf(&tmp, "Partition %s created+configured OK", partition_name);
    19061870                    log_to_screen(tmp);
     1871                    mr_free(tmp);
    19071872                } else {
    19081873                    log_it("Returning from a successful vacuum-pack");
     
    19101875            }
    19111876        } else {
    1912             sprintf(tmp, "Failed to partition %s", partition_name);
     1877            mr_asprintf(&tmp, "Failed to partition %s", partition_name);
    19131878            if (partsize > 0) {
    19141879                log_to_screen(tmp);
     
    19161881                log_it(tmp);
    19171882            }
     1883            mr_free(tmp);
    19181884            retval++;
    19191885        }
    19201886    }
     1887    mr_free(program);
    19211888    paranoid_free(output);
    19221889
    19231890    g_current_progress++;
    19241891    log_it("partition_device() --- leaving");
    1925     paranoid_free(program);
    19261892    paranoid_free(partition_name);
    1927     paranoid_free(tmp);
    1928     paranoid_free(logfile);
    19291893    return (retval);
    19301894}
     
    20351999    /** buffers *********************************************************/
    20362000    char *partition;
    2037     char *command;
     2001    char *command = NULL;
    20382002    char *output = NULL;
    2039     char *tmp;
     2003    char *tmp = NULL;
    20402004    char *partcode;
    2041     char *logfile;
    20422005
    20432006    /** pointers *********************************************************/
     
    20542017
    20552018    malloc_string(partition);
    2056     malloc_string(command);
    2057     malloc_string(tmp);
    20582019    malloc_string(partcode);
    2059     malloc_string(logfile);
    20602020
    20612021    build_partition_name(partition, drive, partno);
    20622022    p = (char *) strrchr(partition, '/');
    2063     sprintf(logfile, "/tmp/fdisk-set-type.%s.log", ++p);
    20642023    if (strcmp(format, "swap") == 0) {
    20652024        strcpy(partcode, "82");
     
    20982057    } else {
    20992058        /* probably an image */
    2100         sprintf(tmp,
     2059        mr_asprintf(&tmp,
    21012060                "Unknown format ('%s') - using supplied string anyway",
    21022061                format);
    21032062        mvaddstr_and_log_it(g_currentY++, 0, tmp);
     2063        mr_free(tmp);
    21042064#ifdef __FreeBSD__
    21052065        strcpy(partcode, format);   // was a5
     
    21082068#endif
    21092069    }
    2110     sprintf(tmp, "Setting %s's type to %s (%s)", partition, format,
    2111             partcode);
    2112     log_msg(1, tmp);
     2070    log_msg(1, tmp, "Setting %s's type to %s (%s)", partition, format, partcode);
    21132071    if (partcode[0] != '\0' && strcmp(partcode, "83")) {    /* no need to set type if 83: 83 is default */
    21142072
     
    21192077                || strstr(last_line_of_file(FDISK_LOG), " (1-4)")) {
    21202078                log_msg(5, "Specifying partno (%d) - yay", partno);
    2121                 sprintf(tmp, "%d\n", partno);
     2079                mr_asprintf(&tmp, "%d\n", partno);
    21222080                fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
     2081                mr_free(tmp);
     2082
    21232083                log_msg(5, "A - last line = '%s'",
    21242084                        last_line_of_file(FDISK_LOG));
    21252085            }
    21262086
    2127             sprintf(tmp, "%s\n", partcode);
     2087            mr_asprintf(&tmp, "%s\n", partcode);
    21282088            fput_string_one_char_at_a_time(pout_to_fdisk, tmp);
     2089            mr_free(tmp);
     2090
    21292091            log_msg(5, "B - last line = '%s'",
    21302092                    last_line_of_file(FDISK_LOG));
     
    21332095                    last_line_of_file(FDISK_LOG));
    21342096
    2135             strcpy(tmp, last_line_of_file(FDISK_LOG));
     2097            mr_asprintf(&tmp, "%s", last_line_of_file(FDISK_LOG));
    21362098            if (!strstr(tmp, " (m ")) {
    21372099                log_msg(1, "last line = '%s'; part type set failed", tmp);
     
    21392101                fput_string_one_char_at_a_time(pout_to_fdisk, "\n");
    21402102            }
     2103            mr_free(tmp);
     2104
    21412105            fput_string_one_char_at_a_time(pout_to_fdisk, "p\n");
    21422106        } else {
    21432107            mr_asprintf(&output, "t\n%d\n%s\nw\n", partno, partcode);
    2144             sprintf(command, "parted2fdisk %s >> %s 2>> %s", drive,
     2108            mr_asprintf(&command, "parted2fdisk %s >> %s 2>> %s", drive,
    21452109                    MONDO_LOGFILE, MONDO_LOGFILE);
    21462110            log_msg(5, "output = '%s'", output);
     
    21572121            }
    21582122            paranoid_free(output);
    2159         }
    2160         if (res) {
    2161             log_OS_error(command);
     2123            mr_free(command);
    21622124        }
    21632125    }
    21642126
    21652127    paranoid_free(partition);
    2166     paranoid_free(command);
    2167     paranoid_free(tmp);
    21682128    paranoid_free(partcode);
    2169     paranoid_free(logfile);
    21702129
    21712130    return (res);
     
    21802139
    21812140    /** buffers *********************************************************/
    2182     char *program;
     2141    char *program = NULL;
    21832142
    21842143    /** end *************************************************************/
    21852144
    21862145    assert_string_is_neither_NULL_nor_zerolength(raid_device);
    2187     malloc_string(program);
    21882146
    21892147#ifdef __FreeBSD__
     
    21922150        return 1;
    21932151    }
    2194     sprintf(program, "vinum start -f %s", raid_device);
     2152    mr_asprintf(&program, "vinum start -f %s", raid_device);
    21952153#else
    2196     sprintf(program, "raidstart %s", raid_device);
     2154    mr_asprintf(&program, "raidstart %s", raid_device);
    21972155#endif
    21982156    log_msg(1, "program = %s", program);
     
    22012159        fprintf(g_fprep, "%s\n", program);
    22022160    }
     2161    mr_free(program);
     2162
    22032163    if (res) {
    22042164        log_msg(1, "Warning - failed to start RAID device %s",
     
    22242184
    22252185    /** buffers *********************************************************/
    2226     char *program;
     2186    char *program = NULL;
    22272187
    22282188    /** end *************************************************************/
    22292189
    22302190    assert_string_is_neither_NULL_nor_zerolength(raid_device);
    2231     malloc_string(program);
    22322191
    22332192#ifdef __FreeBSD__
     
    22362195        return 1;
    22372196    }
    2238     sprintf(program, "vinum stop -f %s", raid_device);
     2197    mr_asprintf(&program, "vinum stop -f %s", raid_device);
    22392198#else
    22402199    // use raidstop if it exists, otherwise use mdadm
    22412200    if (run_program_and_log_output("which raidstop", FALSE)) {
    2242         sprintf(program, "mdadm -S %s", raid_device);
     2201        mr_asprintf(&program, "mdadm -S %s", raid_device);
    22432202    } else {
    2244         sprintf(program, "raidstop %s", raid_device);
     2203        mr_asprintf(&program, "raidstop %s", raid_device);
    22452204    }
    22462205#endif
     
    22502209        fprintf(g_fprep, "%s\n", program);
    22512210    }
     2211    mr_free(program);
     2212
    22522213    if (res) {
    22532214        log_msg(1, "Warning - failed to stop RAID device %s", raid_device);
     
    23712332 * @return 0 for success, nonzero for failure.
    23722333 */
    2373 int which_format_command_do_i_need(char *format, char *program)
     2334char *which_format_command_do_i_need(char *format)
    23742335{
    23752336    /** int *************************************************************/
     
    23772338
    23782339    /** buffers *********************************************************/
    2379     char *tmp;
     2340    char *tmp = NULL;
     2341    char *program = NULL;
    23802342
    23812343    /** end ***************************************************************/
    23822344
    2383     malloc_string(tmp);
    23842345    assert_string_is_neither_NULL_nor_zerolength(format);
    2385     assert(program != NULL);
    23862346
    23872347    if (strcmp(format, "swap") == 0) {
    23882348#ifdef __FreeBSD__
    2389         strcpy(program, "true");
     2349        mr_asprintf(&program, "true");
    23902350#else
    2391         strcpy(program, "mkswap");
     2351        mr_asprintf(&program, "mkswap");
    23922352#endif
    23932353    } else if (strcmp(format, "vfat") == 0) {
    2394         strcpy(program, "format-and-kludge-vfat");
     2354        mr_asprintf(&program, "format-and-kludge-vfat");
    23952355#ifndef __FreeBSD__
    23962356    } else if (strcmp(format, "reiserfs") == 0) {
    2397         strcpy(program, "mkreiserfs -ff");
     2357        mr_asprintf(&program, "mkreiserfs -ff");
    23982358    } else if (strcmp(format, "xfs") == 0) {
    2399         strcpy(program, "mkfs.xfs -f -q");
     2359        mr_asprintf(&program, "mkfs.xfs -f -q");
    24002360    } else if (strcmp(format, "jfs") == 0) {
    2401         strcpy(program, "mkfs.jfs");
     2361        mr_asprintf(&program, "mkfs.jfs");
    24022362    } else if (strcmp(format, "ext3") == 0) {
    2403         strcpy(program, "mkfs -t ext3 -F -q");
     2363        mr_asprintf(&program, "mkfs -t ext3 -F -q");
    24042364    } else if (strcmp(format, "ext4") == 0) {
    2405         strcpy(program, "mkfs -t ext4 -F -q");
     2365        mr_asprintf(&program, "mkfs -t ext4 -F -q");
    24062366    } else if (strcmp(format, "minix") == 0) {
    2407         strcpy(program, "mkfs.minix");
     2367        mr_asprintf(&program, "mkfs.minix");
    24082368    } else if (strcmp(format, "vmfs") == 0) {
    2409         strcpy(program, "mkfs -t vmfs");
     2369        mr_asprintf(&program, "mkfs -t vmfs");
    24102370    } else if (strcmp(format, "ntfs") == 0) {
    24112371        /*
     
    24132373         * so the default "mkfs -t %s -c" command structure fails
    24142374         */
    2415         strcpy(program, "mkfs -t ntfs");
     2375        mr_asprintf(&program, "mkfs -t ntfs");
    24162376    } else if (strcmp(format, "ocfs2") == 0) {
    24172377        /*
     
    24192379         *
    24202380         */
    2421         strcpy(program, "mkfs -t ocfs2 -F");
     2381        mr_asprintf(&program, "mkfs -t ocfs2 -F");
    24222382#endif
    24232383    } else if (strcmp(format, "ext2") == 0) {
    2424         strcpy(program, "mke2fs -F -q");
     2384        mr_asprintf(&program, "mke2fs -F -q");
    24252385    } else {
    24262386#ifdef __FreeBSD__
    2427         sprintf(program, "newfs_%s", format);
     2387        mr_asprintf(&program, "newfs_%s", format);
    24282388#else
    2429         sprintf(program, "mkfs -t %s -c", format);  // -c checks for bad blocks
     2389        mr_asprintf(&program, "mkfs -t %s -c", format); // -c checks for bad blocks
    24302390#endif
    2431         sprintf(tmp, "Unknown format (%s) - assuming '%s' will do", format,
    2432                 program);
     2391        mr_asprintf(&tmp, "Unknown format (%s) - assuming '%s' will do", format, program);
    24332392        log_it(tmp);
     2393        mr_free(tmp);
    24342394        res = 0;
    24352395    }
    2436     paranoid_free(tmp);
    2437     return (res);
     2396    return (program);
    24382397}
    24392398
     
    24552414{
    24562415    /**buffers **********************************************************/
    2457     char *tmp;
     2416    char *tmp = NULL;
    24582417
    24592418    /** int *************************************************************/
     
    24772436    /** end **************************************************************/
    24782437
    2479     malloc_string(tmp);
    24802438    assert(mountlist != NULL);
    24812439    assert_string_is_neither_NULL_nor_zerolength(drive_name);
     
    24842442        if (strncmp(drive_name, RAID_DEVICE_STUB, strlen(RAID_DEVICE_STUB))
    24852443            == 0) {
    2486             paranoid_free(tmp);
    24872444            return;
    24882445        }
     
    24932450    if (current_size_of_drive <= 0) {
    24942451        log_it("Not resizing to match %s - can't find drive", drive_name);
    2495         paranoid_free(tmp);
    24962452        return;
    24972453    }
    2498     sprintf(tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name,
    2499             current_size_of_drive);
     2454    mr_asprintf(&tmp, "Expanding entries to suit drive %s (%ld MB)", drive_name, current_size_of_drive);
    25002455    log_to_screen(tmp);
     2456    mr_free(tmp);
    25012457
    25022458    drivemntlist = malloc(sizeof(struct mountlist_reference));
     
    25162472
    25172473    if (original_size_of_drive <= 0) {
    2518         sprintf(tmp, "Cannot resize %s's entries. Drive not found.",
    2519                 drive_name);
     2474        mr_asprintf(&tmp, "Cannot resize %s's entries. Drive not found.", drive_name);
    25202475        log_to_screen(tmp);
    2521         paranoid_free(tmp);
     2476        mr_free(tmp);
    25222477        return;
    25232478    }
    2524     factor =
    2525         (float) (current_size_of_drive) / (float) (original_size_of_drive);
    2526     sprintf(tmp, "Disk %s was %ld MB; is now %ld MB; factor = %f",
    2527             drive_name, original_size_of_drive, current_size_of_drive,
    2528             factor);
     2479    factor = (float) (current_size_of_drive) / (float) (original_size_of_drive);
     2480    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);
    25292481    log_to_screen(tmp);
     2482    mr_free(tmp);
    25302483
    25312484    lastpart = drivemntlist->entries - 1;
     
    25522505        }
    25532506
    2554         sprintf(tmp, "Changing %s from %lld KB to %ld KB",
    2555                 drivemntlist->el[partno]->device,
    2556                 drivemntlist->el[partno]->size, newsizL);
     2507        mr_asprintf(&tmp, "Changing %s from %lld KB to %ld KB", drivemntlist->el[partno]->device, drivemntlist->el[partno]->size, newsizL);
    25572508        log_to_screen(tmp);
     2509        mr_free(tmp);
    25582510        drivemntlist->el[partno]->size = newsizL;
    25592511    }
    25602512    final_size = get_phys_size_of_drive(drive_name);
    2561     sprintf(tmp, "final_size = %ld MB", final_size);
     2513    mr_asprintf(&tmp, "final_size = %ld MB", final_size);
    25622514    log_to_screen(tmp);
    2563     paranoid_free(tmp);
     2515    mr_free(tmp);
    25642516}
    25652517
  • branches/2.2.10/mondo/src/mondorestore/mondoprep.h

    r684 r2281  
    6969int partition_everything(struct mountlist_itself *);
    7070int do_my_funky_lvm_stuff(bool, bool);
    71 int which_format_command_do_i_need(char *, char *);
     71char *which_format_command_do_i_need(char *);
    7272int make_dummy_partitions(FILE *, char *, int);
    7373int make_list_of_drives(struct mountlist_itself *,
  • branches/2.2.10/mondo/src/mondorestore/mr-externs.h

    r2109 r2281  
    8080extern int verify_tape_backups();
    8181extern char which_restore_mode(void);
    82 extern int which_format_command_do_i_need(char *, char *);
     82extern char *which_format_command_do_i_need(char *);
    8383extern int write_cfg_var(char *, char *, char *);
    8484extern void wrong_marker(int, int);
Note: See TracChangeset for help on using the changeset viewer.