Changeset 2515 in MondoRescue for branches/2.2.9/mondo/src


Ignore:
Timestamp:
Jan 4, 2010, 7:36:09 PM (14 years ago)
Author:
Bruno Cornec
Message:

r3226@localhost (orig r2260): bruno | 2009-07-12 02:04:21 +0200

r3201@localhost: bruno | 2009-07-06 18:36:11 +0200

  • Replace sprintf by mr_asprintf in libmondo-raid.c


File:
1 edited

Legend:

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

    r2241 r2515  
    192192{
    193193    /*@ buffers ***************************************************** */
    194     char *sz_value;
    195 
    196     malloc_string(sz_value);
     194    char *sz_value = NULL;
     195
    197196    assert(raidrec != NULL);
    198197    assert(label != NULL);
    199198
    200     sprintf(sz_value, "%d", value);
     199    mr_asprintf(&sz_value, "%d", value);
    201200    strcpy(raidrec->additional_vars.el[lino].label, label);
    202201    strcpy(raidrec->additional_vars.el[lino].value, sz_value);
    203     paranoid_free(sz_value);
     202    mr_free(sz_value);
    204203}
    205204#endif
     
    472471{
    473472    FILE *fin;
    474     char *tmp;
     473    char *tmp1 = NULL;
    475474    int items;
    476475
    477     malloc_string(tmp);
    478476    raidlist->spares.entries = 0;
    479477    raidlist->disks.entries = 0;
     
    481479        log_it("Raidtab is very small or non-existent. Ignoring it.");
    482480        raidlist->entries = 0;
    483         paranoid_free(tmp);
    484481        return (0);
    485482    }
    486483    if (!(fin = fopen(fname, "r"))) {
    487484        log_it("Cannot open raidtab");
    488         paranoid_free(tmp);
    489485        return (1);
    490486    }
     
    589585    fclose(fin);
    590586    log_it("Raidtab loaded successfully.");
    591     sprintf(tmp, "%d RAID devices in raidtab", raidlist->entries);
    592     log_it(tmp);
    593     paranoid_free(tmp);
     587    mr_asprintf(&tmp1, "%d RAID devices in raidtab", raidlist->entries);
     588    log_it(tmp1);
     589    mr_free(tmp1);
    594590    return (0);
    595591}
     
    691687
    692688    /*@ add mallocs * */
    693     char *tmp;
     689    char *tmp = NULL;
    694690    char *labelB;
    695691    char *valueB;
     
    699695    int v;
    700696
    701     malloc_string(tmp);
    702697    malloc_string(labelB);
    703698    malloc_string(valueB);
     
    749744        }
    750745        if (!disklist) {
    751             sprintf(tmp,
    752                     "Ignoring '%s %s' pair of disk %s", labelB, valueB,
    753                     label);
     746            mr_asprintf(&tmp, "Ignoring '%s %s' pair of disk %s", labelB, valueB, label);
    754747            log_it(tmp);
     748            mr_free(tmp);
    755749        } else {
    756750            index = atoi(valueB);
     
    763757        raidrec->additional_vars.entries = ++v;
    764758    }
    765     paranoid_free(tmp);
    766759    paranoid_free(labelB);
    767760    paranoid_free(valueB);
Note: See TracChangeset for help on using the changeset viewer.