Ignore:
Timestamp:
Aug 28, 2009, 2:46:29 AM (15 years ago)
Author:
Bruno Cornec
Message:

Change inerface of evaluate_mountlist and spread_flaws_across_three_lines in order to solve bugs linked to strings management in these functions. May fix a restoration crash seen by some customers (backport from 2.2.9)

File:
1 edited

Legend:

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

    r2334 r2352  
    19241924    /** int **************************************************************/
    19251925    int i = 0;
     1926    int res = 0;
    19261927    int currline = 0;
    19271928    int finished = FALSE;
     
    19291930    /** buffers **********************************************************/
    19301931    char *tmp = NULL;
     1932    char *flaws_str = NULL;
    19311933    char *flaws_str_A = NULL;
    19321934    char *flaws_str_B = NULL;
     
    19361938    assert(raidlist != NULL);
    19371939
    1938     mr_asprintf(flaws_str_A, "%s", "         ");
    1939     mr_asprintf(flaws_str_B, "%s", "         ");
    1940     mr_asprintf(flaws_str_C, "%s", "         ");
    19411940    if (mountlist->entries > ARBITRARY_MAXIMUM) {
    19421941        log_to_screen("Arbitrary limits suck, man!");
     
    19541953    mr_asprintf(tmp, "%-24s %-24s %-8s  %s", "Device", "Mountpoint", "Format", "Size (MB)");
    19551954    headerMsg = newtLabel(2, 1, tmp);
    1956     flawsLabelA = newtLabel(2, 13, flaws_str_A);
    1957     flawsLabelB = newtLabel(2, 14, flaws_str_B);
    1958     flawsLabelC = newtLabel(2, 15, flaws_str_C);
     1955    flawsLabelA = newtLabel(2, 13, "         ");
     1956    flawsLabelB = newtLabel(2, 14, "         ");
     1957    flawsLabelC = newtLabel(2, 15, "         ");
    19591958    partitionsListbox =
    19601959        newtListbox(2, 2, 10, NEWT_FLAG_SCROLL | NEWT_FLAG_RETURNEXIT);
     
    19661965                          bEdit, bDelete, bReload, bCancel, bOK, NULL);
    19671966    while (!finished) {
    1968         evaluate_mountlist(mountlist, flaws_str_A, flaws_str_B,
    1969                            flaws_str_C);
     1967        flaws_str = evaluate_mountlist(mountlist, &res);
     1968        spread_flaws_across_three_lines(flaws_str, flaws_str_A, flaws_str_B, flaws_str_C);
     1969
     1970        mr_free(flaws_str);
     1971
    19701972        newtLabelSetText(flawsLabelA, flaws_str_A);
    19711973        newtLabelSetText(flawsLabelB, flaws_str_B);
    19721974        newtLabelSetText(flawsLabelC, flaws_str_C);
    19731975        b_res = newtRunForm(myForm);
     1976        mr_free(flaws_str_A);
     1977        mr_free(flaws_str_B);
     1978        mr_free(flaws_str_C);
     1979
    19741980        if (b_res == bOK) {
    1975             if (!evaluate_mountlist
    1976                 (mountlist, flaws_str_A, flaws_str_B, flaws_str_C)) {
     1981            flaws_str = evaluate_mountlist(mountlist, &res);
     1982            mr_free(flaws_str);
     1983            if (!res) {
    19771984                finished =
    19781985                    ask_me_yes_or_no
Note: See TracChangeset for help on using the changeset viewer.