Changeset 2242


Ignore:
Timestamp:
Jun 29, 2009, 7:19:18 PM (10 years ago)
Author:
bruno
Message:

r3145@localhost: bruno | 2009-06-29 17:18:58 +0200

  • Remove 2 memory leaks and change the behavoir for function media_descriptor_string which now allocates the string it returns (which needs to be free by the caller)
Location:
branches/2.2.9/mondo/src
Files:
8 edited

Legend:

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

    r2241 r2242  
    15861586    char *message_to_screen = NULL;
    15871587    char *old_pwd;
     1588    char *mds = NULL;
    15881589
    15891590    malloc_string(old_pwd);
     
    15971598    (void)chdir(bkpinfo->scratchdir);
    15981599
    1599     mr_asprintf(&message_to_screen, "Copying data to make %s #%d",
    1600                 media_descriptor_string(bkpinfo->backup_media_type),
    1601                 g_current_media_number);
     1600    mds = media_descriptor_string(bkpinfo->backup_media_type);
     1601    mr_asprintf(&message_to_screen, "Copying data to make %s #%d",mds, g_current_media_number);
     1602    mr_free(mds);
    16021603    log_msg(1, message_to_screen);
    16031604
     
    16891690    char *tmp2;
    16901691    char *tmp3;
     1692    char *mds = NULL;
    16911693    bool cd_is_mountable;
    16921694
     
    17461748        log_msg(2, "bkpinfo->call_make_iso = %s", bkpinfo->call_make_iso);
    17471749        sprintf(tmp, "%s/archives/NOT-THE-LAST", bkpinfo->scratchdir);
    1748         mr_asprintf(&message_to_screen, "Making an ISO (%s #%d)",
    1749                 media_descriptor_string(bkpinfo->backup_media_type),
    1750                 g_current_media_number);
     1750        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1751        mr_asprintf(&message_to_screen, "Making an ISO (%s #%d)", mds, g_current_media_number);
     1752        mr_free(mds);
    17511753
    17521754        pause_and_ask_for_cdr(2, &cd_is_mountable); /* if g_current_media_number >= 2 then pause & ask */
     
    18431845        paranoid_free(message_to_screen);
    18441846    } else {
    1845         mr_asprintf(&message_to_screen, "Running mkisofs to make %s #%d",
    1846                 media_descriptor_string(bkpinfo->backup_media_type),
    1847                 g_current_media_number);
     1847        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1848        mr_asprintf(&message_to_screen, "Running mkisofs to make %s #%d", mds, g_current_media_number);
    18481849        log_msg(1, message_to_screen);
    1849         mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ",
    1850                 media_descriptor_string(bkpinfo->backup_media_type),
    1851                 g_current_media_number);
     1850        mr_asprintf(&result_sz, "Call to mkisofs to make ISO (%s #%d) ", mds,  g_current_media_number);
     1851        mr_free(mds);
    18521852        if (bkpinfo->nonbootable_backup) {
    18531853            log_msg(1, "Making nonbootable backup");
     
    19251925    if (bkpinfo->call_burn_iso[0] != '\0') {
    19261926        log_msg(2, "bkpinfo->call_burn_iso = %s", bkpinfo->call_burn_iso);
    1927         mr_asprintf(&message_to_screen, "Burning %s #%d",
    1928                 media_descriptor_string(bkpinfo->backup_media_type),
    1929                 g_current_media_number);
     1927        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1928        mr_asprintf(&message_to_screen, "Burning %s #%d", mds, g_current_media_number);
     1929        mr_free(mds);
    19301930        pause_and_ask_for_cdr(2, &cd_is_mountable);
    19311931        res =
     
    19451945
    19461946    if (bkpinfo->call_after_iso[0] != '\0') {
    1947         mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)",
    1948                 media_descriptor_string(bkpinfo->backup_media_type),
    1949                 g_current_media_number);
     1947        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1948        mr_asprintf(&message_to_screen, "Running post-ISO call (%s #%d)", mds, g_current_media_number);
     1949        mr_free(mds);
    19501950        res =
    19511951            eval_call_to_make_ISO(bkpinfo->call_after_iso,
     
    20522052    assert_string_is_neither_NULL_nor_zerolength(biggielist_fname);
    20532053
    2054     malloc_string(bigfile_fname);
    20552054    estimated_total_noof_slices =
    20562055        size_of_all_biggiefiles_K() / bkpinfo->optimal_set_size + 1;
     
    20782077        return (1);
    20792078    }
     2079
     2080    malloc_string(bigfile_fname);
    20802081    for (fgets(bigfile_fname, MAX_STR_LEN, fin); !feof(fin);
    20812082         fgets(bigfile_fname, MAX_STR_LEN, fin), biggie_file_number++) {
     
    27592760    char *szserfname;
    27602761    char *szunmount;
     2762    char *mds = NULL;
    27612763
    27622764    malloc_string(tmp);
     
    27692771    malloc_string(szunmount);
    27702772
    2771     sprintf(szmsg, "I am about to burn %s #%d",
    2772             media_descriptor_string(g_backup_media_type),
    2773             g_current_media_number);
     2773    mds = media_descriptor_string(g_backup_media_type);
     2774    sprintf(szmsg, "I am about to burn %s #%d", mds, g_current_media_number);
     2775    mr_free(mds);
    27742776    log_to_screen(szmsg);
    27752777    if (g_current_media_number < ask_for_one_if_more_than_this) {
     
    28122814        } else if (!does_file_exist(szcdno)
    28132815                   || !does_file_exist(szserfname)) {
     2816            mds = media_descriptor_string(g_backup_media_type);
    28142817            log_to_screen
    2815                 ("%s has data on it but it's probably not a Mondo CD.",
    2816                  media_descriptor_string(g_backup_media_type));
     2818                ("%s has data on it but it's probably not a Mondo CD.", mds);
     2819            mr_free(mds);
    28172820        } else {
    2818             log_to_screen("%s found in drive. It's a Mondo disk.",
    2819                           media_descriptor_string(g_backup_media_type));
     2821            mds = media_descriptor_string(g_backup_media_type);
     2822            log_to_screen("%s found in drive. It's a Mondo disk.", mds);
     2823            mr_free(mds);
     2824
    28202825            cd_number = atoi(last_line_of_file(szcdno));
    28212826            sprintf(tmp, "cat %s 2> /dev/null", szserfname);
     
    28302835                our_serial_str, g_serial_string);
    28312836        if (cd_number > 0 && !strcmp(our_serial_str, g_serial_string)) {
    2832             log_msg(2, "This %s is part of this backup set!",
    2833                     media_descriptor_string(g_backup_media_type));
     2837            mds = media_descriptor_string(g_backup_media_type);
     2838            log_msg(2, "This %s is part of this backup set!", mds);
    28342839            ok_go_ahead_burn_it = FALSE;
    28352840            if (cd_number == g_current_media_number - 1) {
    2836                 log_to_screen
    2837                     ("I think you've left the previous %s in the drive.",
    2838                      media_descriptor_string(g_backup_media_type));
     2841                log_to_screen("I think you've left the previous %s in the drive.", mds);
    28392842            } else {
    2840                 log_to_screen
    2841                     ("Please remove this %s. It is part of the backup set you're making now.",
    2842                      media_descriptor_string(g_backup_media_type));
     2843                log_to_screen("Please remove this %s. It is part of the backup set you're making now.", mds);
    28432844            }
     2845            mr_free(mds);
     2846
    28442847        } else {
    28452848            log_to_screen("...but not part of _our_ backup set.");
     
    28472850        mr_free(our_serial_str);
    28482851    } else {
     2852        mds = media_descriptor_string(g_backup_media_type);
    28492853        log_msg(2,
    2850                 "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?",
    2851                 media_descriptor_string(g_backup_media_type));
     2854                "paafcd: Can't find CD-ROM drive. Perhaps it has a blank %s in it?", mds);
    28522855        if (interrogate_disk_currently_in_cdrw_drive(cdrw_dev, FALSE)) {
    28532856            ok_go_ahead_burn_it = FALSE;
    2854             log_to_screen("There isn't a writable %s in the drive.",
    2855                           media_descriptor_string(g_backup_media_type));
    2856         }
    2857     }
    2858 
    2859 /*
    2860   if (g_current_media_number > ask_for_one_if_more_than_this)
    2861     {
    2862       ok_go_ahead_burn_it = FALSE;
    2863       log_it("paafcd: %d > %d, so I'll definitely pause.", g_current_media_number > ask_for_one_if_more_than_this);
    2864     }
    2865 */
     2857            log_to_screen("There isn't a writable %s in the drive.", mds);
     2858        }
     2859        mr_free(mds);
     2860    }
    28662861
    28672862    if (!ok_go_ahead_burn_it) {
    28682863        eject_device(cdrom_dev);
     2864        mds = media_descriptor_string(g_backup_media_type);
    28692865        sprintf(tmp,
    2870                 "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.",
    2871                 media_descriptor_string(g_backup_media_type),
    2872                 g_current_media_number,
    2873                 media_descriptor_string(g_backup_media_type));
     2866                "I am about to burn %s #%d of the backup set. Please insert %s and press Enter.", 
     2867                mds, g_current_media_number, mds);
     2868        mr_free(mds);
     2869
    28742870        popup_and_OK(tmp);
    28752871        goto gotos_make_me_puke;
     
    28782874    }
    28792875
     2876    mds = media_descriptor_string(g_backup_media_type);
    28802877    log_msg(2,
    2881             "paafcd: OK, I assume I have a blank/reusable %s in the drive...",
    2882             media_descriptor_string(g_backup_media_type));
     2878            "paafcd: OK, I assume I have a blank/reusable %s in the drive...", mds);
    28832879
    28842880    //  if (ask_for_one_if_more_than_this>1) { popup_and_OK(szmsg); }
    28852881
    2886     log_to_screen("Proceeding w/ %s in drive.",
    2887                   media_descriptor_string(g_backup_media_type));
     2882    log_to_screen("Proceeding w/ %s in drive.", mds);
     2883    mr_free(mds);
     2884
    28882885    paranoid_free(tmp);
    28892886    paranoid_free(szmsg);
     
    33693366    char *lastcd_fname;
    33703367    char *isofile;
     3368    char *mds = NULL;
    33713369
    33723370    /*@ bool ******************************************************** */
     
    33883386    }
    33893387
    3390     log_msg(1, "OK, time to make %s #%d",
    3391             media_descriptor_string(bkpinfo->backup_media_type),
    3392             g_current_media_number);
     3388    mds = media_descriptor_string(bkpinfo->backup_media_type);
     3389    log_msg(1, "OK, time to make %s #%d", mds, g_current_media_number);
     3390    mr_free(mds);
    33933391
    33943392    /* label the ISO with its number */
     
    34473445        }
    34483446        if (bkpinfo->verify_data && !res) {
     3447            mds = media_descriptor_string(g_backup_media_type);
    34493448            log_to_screen
    3450                 ("Please reboot from the 1st %s in Compare Mode, as a precaution.",
    3451                  media_descriptor_string(g_backup_media_type));
     3449                ("Please reboot from the 1st %s in Compare Mode, as a precaution.", mds);
     3450            mr_free(mds);
    34523451            chdir("/");
    34533452            log_it("Before calling verification of image()");
     
    34623461            that_one_was_ok = TRUE;
    34633462        } else {
    3464             sprintf(tmp, "Failed to create %s #%d. Retry?",
    3465                     media_descriptor_string(bkpinfo->backup_media_type),
    3466                     g_current_media_number);
     3463            mds = media_descriptor_string(bkpinfo->backup_media_type);
     3464            sprintf(tmp, "Failed to create %s #%d. Retry?", mds, g_current_media_number);
     3465            mr_free(mds);
    34673466            res = ask_me_yes_or_no(tmp);
    34683467            if (!res) {
     
    35253524    int res = 0, retval = 0, cdno = 0;
    35263525    char *tmp;
     3526    char *mds = NULL;
    35273527    long diffs = 0;
    35283528
     
    35643564            retval += res;
    35653565            if (res) {
     3566                mds = media_descriptor_string(bkpinfo->backup_media_type);
    35663567                sprintf(tmp,
    3567                         "Warnings/errors were reported while checking %s #%d",
    3568                         media_descriptor_string(bkpinfo->backup_media_type),
    3569                         g_current_media_number);
     3568                        "Warnings/errors were reported while checking %s #%d", mds, g_current_media_number);
     3569                mr_free(mds);
    35703570                log_to_screen(tmp);
    35713571
  • branches/2.2.9/mondo/src/common/libmondo-devices.c

    r2241 r2242  
    13591359    /*@ buffers ********************************************************* */
    13601360    char *tmp;
     1361    char *mds = NULL;
    13611362    char *request;
    13621363
     
    14101411        log_msg(3, "Currently, we hold %d but we want %d", res,
    14111412                cd_number_i_want);
    1412         sprintf(tmp, "Insisting on %s #%d",
    1413                 media_descriptor_string(bkpinfo->backup_media_type),
    1414                 cd_number_i_want);
    1415         sprintf(request, "Please insert %s #%d and press Enter.",
    1416                 media_descriptor_string(bkpinfo->backup_media_type),
    1417                 cd_number_i_want);
     1413        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1414        sprintf(tmp, "Insisting on %s #%d", mds, cd_number_i_want);
     1415        sprintf(request, "Please insert %s #%d and press Enter.", mds, cd_number_i_want);
     1416        mr_free(mds);
    14181417        log_msg(3, tmp);
    14191418        while (what_number_cd_is_this() != cd_number_i_want) {
     
    14701469{
    14711470    char *tmp = NULL;
     1471    char *mds = NULL;
    14721472    char *sz_size;
    14731473    char *command;
     
    15341534                finish(1);
    15351535            }
    1536             sprintf(comment, "What speed is your %s (re)writer?",
    1537                     media_descriptor_string(bkpinfo->backup_media_type));
     1536            mds = media_descriptor_string(bkpinfo->backup_media_type);
     1537            sprintf(comment, "What speed is your %s (re)writer?", mds);
    15381538            if (bkpinfo->backup_media_type == dvd) {
    15391539                find_dvd_device(bkpinfo->media_device, FALSE);
     
    15571557
    15581558            sprintf(comment,
    1559                     "How much data (in Megabytes) will each %s store?",
    1560                     media_descriptor_string(bkpinfo->backup_media_type));
     1559                    "How much data (in Megabytes) will each %s store?", mds);
     1560            mr_free(mds);
    15611561            if (!popup_and_get_string("Size", comment, sz_size, 5)) {
    15621562                log_to_screen("User has chosen not to backup the PC");
     
    15731573        /* No break because we continue even for usb */
    15741574    case cdstream:
     1575        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1576
    15751577        if ((bkpinfo->disaster_recovery) && (bkpinfo->backup_media_type != usb)) {
    15761578            strcpy(bkpinfo->media_device, "/dev/cdrom");
     
    15891591                        bkpinfo->media_device);
    15901592                sprintf(comment,
    1591                         "Please specify your %s drive's /dev entry",
    1592                         media_descriptor_string(bkpinfo->backup_media_type));
     1593                        "Please specify your %s drive's /dev entry", mds);
    15931594                if (!popup_and_get_string
    15941595                    ("Device?", comment, bkpinfo->media_device,
     
    15981599                }
    15991600            }
    1600             log_msg(2, "%s device found at %s",
    1601                     media_descriptor_string(bkpinfo->backup_media_type),
    1602                     bkpinfo->media_device);
     1601            log_msg(2, "%s device found at %s", mds, bkpinfo->media_device);
    16031602        } else {
    16041603            if ((find_cdrw_device(bkpinfo->media_device)) && (bkpinfo->backup_media_type != usb)) {
     
    16081607                if (bkpinfo->backup_media_type == usb) {
    16091608                    mr_asprintf(&tmp,
    1610                         "I think your %s media corresponds to %s. Is this correct?",
    1611                         media_descriptor_string(bkpinfo->backup_media_type),
     1609                        "I think your %s media corresponds to %s. Is this correct?", mds,
    16121610                        bkpinfo->media_device);
    16131611                } else {
    16141612                    mr_asprintf(&tmp,
    1615                         "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)",
    1616                         media_descriptor_string(bkpinfo->backup_media_type),
     1613                        "I think I've found your %s burner at SCSI node %s. Is this correct? (Say no if you have an IDE burner and you are running a 2.6 kernel. You will then be prompted for further details.)", mds,
    16171614                        bkpinfo->media_device);
    16181615                }
     
    16471644            }
    16481645        }
     1646        mr_free(mds);
     1647
    16491648        if (bkpinfo->backup_media_type == cdstream) {
    16501649            for (i = 0; i <= MAX_NOOF_MEDIA; i++) {
  • branches/2.2.9/mondo/src/common/libmondo-files.c

    r2053 r2242  
    1010
    1111#include "my-stuff.h"
     12#include "mr_mem.h"
    1213#include "mondostructures.h"
    1314#include "libmondo-files.h"
     
    12211222    /*@ buffers *************** */
    12221223    char tmp[MAX_STR_LEN];
     1224    char *mds = NULL;
    12231225
    12241226    /*@ long long ************* */
     
    12471249    }
    12481250    if (scratchLL <= 1) {
     1251        mds = media_descriptor_string(bkpinfo->backup_media_type);
    12491252        sprintf(tmp,
    1250                 "Your backup will probably occupy a single %s. Maybe two.",
    1251                 media_descriptor_string(bkpinfo->backup_media_type));
     1253                "Your backup will probably occupy a single %s. Maybe two.", mds);
     1254        mr_free(mds);
    12521255    } else if (scratchLL > 4) {
    12531256        sprintf(tmp,
  • branches/2.2.9/mondo/src/common/libmondo-string.c

    r2241 r2242  
    10921092    static char outstr[MAX_STR_LEN];
    10931093    char *pos_w_commas, *tmp;
     1094    char *mds = NULL;
    10941095
    10951096    assert(bkpinfo != NULL);
     
    11221123            (int) (space_occupied_by_cd(bkpinfo->scratchdir) * 100 / 1024 /
    11231124                   bkpinfo->media_size[g_current_media_number]);
    1124         sprintf(outstr, "%s %d: [",
    1125                 media_descriptor_string(bkpinfo->backup_media_type),
    1126                 g_current_media_number);
     1125        mds = media_descriptor_string(bkpinfo->backup_media_type);
     1126        sprintf(outstr, "%s %d: [", mds, g_current_media_number);
     1127        mr_free(mds);
    11271128    }
    11281129    for (j = 0; j < percentage; j += 5) {
     
    11461147 */
    11471148/* BCO/BERLIOS change that function to allocate memory, return a pointer and modify caller to free the mem */
    1148 char *media_descriptor_string(t_bkptype type_of_bkp)
    1149 {
    1150     static char *type_of_backup = NULL;
    1151 
    1152     if (!type_of_backup) {
    1153         malloc_string(type_of_backup);
    1154     }
     1149char *media_descriptor_string(t_bkptype type_of_bkp) {
     1150
     1151    char *type_of_backup = NULL;
    11551152
    11561153    switch (type_of_bkp) {
    11571154    case dvd:
    1158         strcpy(type_of_backup, "DVD");
     1155        mr_asprintf(&type_of_backup, "DVD");
    11591156        break;
    11601157    case cdr:
    1161         strcpy(type_of_backup, "CDR");
     1158        mr_asprintf(&type_of_backup, "CDR");
    11621159        break;
    11631160    case cdrw:
    1164         strcpy(type_of_backup, "CDRW");
     1161        mr_asprintf(&type_of_backup, "CDRW");
    11651162        break;
    11661163    case tape:
    1167         strcpy(type_of_backup, "tape");
     1164        mr_asprintf(&type_of_backup, "tape");
    11681165        break;
    11691166    case cdstream:
    1170         strcpy(type_of_backup, "CDR");
     1167        mr_asprintf(&type_of_backup, "CDR");
    11711168        break;
    11721169    case udev:
    1173         strcpy(type_of_backup, "udev");
     1170        mr_asprintf(&type_of_backup, "udev");
    11741171        break;
    11751172    case iso:
    1176         strcpy(type_of_backup, "ISO");
     1173        mr_asprintf(&type_of_backup, "ISO");
    11771174        break;
    11781175    case nfs:
    1179         strcpy(type_of_backup, "nfs");
     1176        mr_asprintf(&type_of_backup, "nfs");
    11801177        break;
    11811178    case usb:
    1182         strcpy(type_of_backup, "USB");
     1179        mr_asprintf(&type_of_backup, "USB");
    11831180        break;
    11841181    default:
    1185         strcpy(type_of_backup, "ISO");
     1182        mr_asprintf(&type_of_backup, "ISO");
    11861183    }
    11871184    return (type_of_backup);
  • branches/2.2.9/mondo/src/common/libmondo-verify.c

    r2230 r2242  
    152152    /*@ buffers ********************************************************* */
    153153    char *tmp;
     154    char *mds = NULL;
    154155
    155156    /*@ int ************************************************************* */
     
    183184        }
    184185    }
    185     sprintf(tmp, "Verifying %s #%d's tarballs",
    186             media_descriptor_string(bkpinfo->backup_media_type),
    187             g_current_media_number);
     186    mds = media_descriptor_string(bkpinfo->backup_media_type);
     187    sprintf(tmp, "Verifying %s #%d's tarballs", mds, g_current_media_number);
     188    mr_free(mds);
     189
    188190    open_evalcall_form(tmp);
    189191
     
    229231//  char ca, cb;
    230232    char *command;
     233    char *mds = NULL;
    231234    char *sz_exe;
    232235    static char *bufblkA = NULL;
     
    282285
    283286    log_it("before vsbf");
    284     sprintf(tmp, "Verifying %s#%d's big files",
    285             media_descriptor_string(bkpinfo->backup_media_type),
    286             g_current_media_number);
     287    mds = media_descriptor_string(bkpinfo->backup_media_type);
     288    sprintf(tmp, "Verifying %s#%d's big files", mds, g_current_media_number);
     289    mr_free(mds);
     290
    287291    open_evalcall_form(tmp);
    288292    log_it("after vsbf");
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-compare.c

    r2230 r2242  
    382382
    383383    char *tarball_fname, *progress_str, *tmp;
     384    char *mds = NULL;
    384385    long max_val;
    385386
     
    393394
    394395    max_val = atol(tmp);
    395     sprintf(progress_str, "Comparing with %s #%d ",
    396             media_descriptor_string(bkpinfo->backup_media_type),
    397             g_current_media_number);
     396    mds = media_descriptor_string(bkpinfo->backup_media_type);
     397    sprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
    398398
    399399    open_progress_form("Comparing files",
     
    440440            log_msg(2, "OK, I think it's time for another CD...");
    441441            g_current_media_number++;
    442             sprintf(progress_str, "Comparing with %s #%d ",
    443                     media_descriptor_string(bkpinfo->backup_media_type),
    444                     g_current_media_number);
     442            sprintf(progress_str, "Comparing with %s #%d ", mds, g_current_media_number);
    445443            log_to_screen(progress_str);
    446444        } else {
     
    451449        }
    452450    }
     451    mr_free(mds);
     452
    453453    close_progress_form();
    454454    if (retval) {
  • branches/2.2.9/mondo/src/mondorestore/mondo-rstr-tools.c

    r2230 r2242  
    279279char *mount_isodir_command = NULL;
    280280char *tmp, *command;
     281char *mds = NULL;
    281282int retval = 0, i;
    282283bool already_mounted = FALSE;
     
    331332}
    332333i = what_number_cd_is_this();   /* has the side-effect of calling mount_media() */
    333 sprintf(tmp, "%s #%d has been mounted via loopback mount",
    334     media_descriptor_string(bkpinfo->backup_media_type), i);
     334mds = media_descriptor_string(bkpinfo->backup_media_type);
     335sprintf(tmp, "%s #%d has been mounted via loopback mount", mds, i);
     336mr_free(mds);
     337
    335338log_msg(1, tmp);
    336339if (i < 0) {
  • branches/2.2.9/mondo/src/mondorestore/mondorestore.c

    r2230 r2242  
    10751075    char *bigblk;
    10761076    char *p;
     1077    char *mds = NULL;
    10771078    int retval = 0;
    10781079    int finished = FALSE;
     
    12421243                    g_current_media_number);
    12431244            g_current_media_number++;
     1245            mds = media_descriptor_string(bkpinfo->backup_media_type);
    12441246            sprintf(tmp,
    1245                     "Asking for %s #%d so that I may read slice #%ld\n",
    1246                     media_descriptor_string(bkpinfo->backup_media_type),
     1247                    "Asking for %s #%d so that I may read slice #%ld\n", mds,
    12471248                    g_current_media_number, sliceno);
    12481249            log_msg(2, tmp);
    1249             sprintf(tmp, "Restoring from %s #%d",
    1250                     media_descriptor_string(bkpinfo->backup_media_type),
    1251                     g_current_media_number);
     1250            sprintf(tmp, "Restoring from %s #%d", mds, g_current_media_number);
     1251            mr_free(mds);
     1252
    12521253            log_to_screen(tmp);
    12531254            insist_on_this_cd_number(g_current_media_number);
     
    13011302                                    suffix), MONDO_LOGFILE);
    13021303            }
    1303             sprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld    ",
    1304                     media_descriptor_string(bkpinfo->backup_media_type),
     1304            mds = media_descriptor_string(bkpinfo->backup_media_type);
     1305            sprintf(tmp, "Working on %s #%d, file #%ld, slice #%ld    ", mds,
    13051306                    g_current_media_number, bigfileno + 1, sliceno);
     1307            mr_free(mds);
    13061308            log_msg(2, tmp);
    13071309
     
    19121914  /** malloc add ***/
    19131915    char *tmp;
     1916    char *mds = NULL;
    19141917    char *command;
    19151918    char *afio_fname;
     
    19321935    /* to do it with a file... */
    19331936    use_star = (strstr(tarball_fname, ".star")) ? TRUE : FALSE;
     1937    mds = media_descriptor_string(bkpinfo->backup_media_type);
    19341938    sprintf(tmp,
    19351939            "Restoring from fileset #%ld (%ld KB) on %s #%d",
    1936             current_tarball_number, (long) size >> 10,
    1937             media_descriptor_string(bkpinfo->backup_media_type),
    1938             g_current_media_number);
     1940            current_tarball_number, (long) size >> 10, mds, g_current_media_number);
     1941    mr_free(mds);
     1942
    19391943    log_msg(2, tmp);
    19401944    run_program_and_log_output("mkdir -p " MNT_RESTORING "/tmp", FALSE);
     
    21012105  /** malloc **/
    21022106    char *tmp;
     2107    char *mds = NULL;
    21032108    bool just_changed_cds = FALSE;
    21042109    char *xattr_fname;
     
    21492154            log_msg(3,
    21502155                    "...but its first slice isn't on this CD. Perhaps this was a selective restore?");
     2156            mds = media_descriptor_string(bkpinfo->backup_media_type);
    21512157            log_msg(3, "Cannot find bigfile #%ld 's first slice on %s #%d",
    2152                     bigfileno + 1,
    2153                     media_descriptor_string(bkpinfo->backup_media_type),
     2158                    bigfileno + 1, mds,
    21542159                    g_current_media_number);
    21552160            log_msg(3, "Slicename would have been %s",
     
    21622167            } else if (does_file_exist(MNT_CDROM "/archives/NOT-THE-LAST")) {
    21632168                insist_on_this_cd_number(++g_current_media_number);
    2164                 sprintf(tmp, "Restoring from %s #%d",
    2165                         media_descriptor_string(bkpinfo->backup_media_type),
     2169                sprintf(tmp, "Restoring from %s #%d", mds,
    21662170                        g_current_media_number);
    21672171                log_to_screen(tmp);
     
    21762180                bigfileno++;
    21772181            }
     2182            mr_free(mds);
    21782183        } else {
    21792184            just_changed_cds = FALSE;
     
    22512256  /**malloc ***/
    22522257    char *tmp = NULL;
     2258    char *mds = NULL;
    22532259    char *tmp1 = NULL;
    22542260    char *tarball_fname;
     
    22752281    paranoid_free(tmp);
    22762282
    2277     sprintf(progress_str, "Restoring from %s #%d",
    2278             media_descriptor_string(bkpinfo->backup_media_type),
    2279             g_current_media_number);
     2283    mds = media_descriptor_string(bkpinfo->backup_media_type);
     2284    sprintf(progress_str, "Restoring from %s #%d", mds, g_current_media_number);
     2285
    22802286    log_to_screen(progress_str);
    22812287    open_progress_form("Restoring from archives",
     
    23272333        } else {
    23282334            sprintf(progress_str, "Restoring from fileset #%ld on %s #%d",
    2329                     current_tarball_number,
    2330                     media_descriptor_string(bkpinfo->backup_media_type),
    2331                     g_current_media_number);
     2335                    current_tarball_number, mds, g_current_media_number);
    23322336//    log_msg(3, "progress_str = %s", progress_str);
    23332337            for (res = 999, attempts = 0; attempts < 3 && res != 0;
     
    23392343            }
    23402344            mr_asprintf(&tmp1, "%s #%d, fileset #%ld - restore ",
    2341                     media_descriptor_string(bkpinfo->backup_media_type),
    2342                     g_current_media_number, current_tarball_number);
     2345                    mds, g_current_media_number, current_tarball_number);
    23432346            if (res) {
    23442347                mr_strcat(tmp1, "reported errors");
     
    23622365        }
    23632366    }
     2367    mr_free(mds);
     2368
    23642369    close_progress_form();
    23652370    if (retval) {
     
    25762581  /** malloc **/
    25772582    char *tmp;
     2583    char *mds = NULL;
    25782584    char *progress_str;
    25792585    char *tmp_fname;
     
    26612667        current_afioball_number++;
    26622668        g_current_progress++;
     2669        mds = media_descriptor_string(bkpinfo->backup_media_type),
    26632670        sprintf(progress_str, "Restoring from fileset #%ld on %s #%d",
    2664                 current_afioball_number,
    2665                 media_descriptor_string(bkpinfo->backup_media_type),
     2671                current_afioball_number, mds,
    26662672                g_current_media_number);
     2673        mr_free(mds);
    26672674        res =
    26682675            read_header_block_from_stream(&tmp_size, tmp_fname, &ctrl_chr);
Note: See TracChangeset for help on using the changeset viewer.