Ignore:
Timestamp:
Aug 28, 2009, 2:24:19 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

File:
1 edited

Legend:

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

    r2242 r2350  
    608608 * @param flaws_str_B Where to put the second 74-or-less characters.
    609609 * @param flaws_str_C Where to put the rest.
    610  * @param res The result of the original evaluate_mountlist() operation.
    611  * @return TRUE if res == 0, FALSE otherwise.
    612  */
    613 bool
     610 */
     611void
    614612spread_flaws_across_three_lines(char *flaws_str, char *flaws_str_A,
    615                                 char *flaws_str_B, char *flaws_str_C,
    616                                 int res)
     613                                char *flaws_str_B, char *flaws_str_C)
    617614{
    618615
     
    621618
    622619    /*@ initialize ****************************************************** */
    623     assert(flaws_str_A != NULL);
    624     assert(flaws_str_B != NULL);
    625     assert(flaws_str_C != NULL);
    626620    assert(flaws_str != NULL);
    627621
    628     if (!res && !strlen(flaws_str)) {
    629         return (TRUE);
    630     }
    631622    if (strlen(flaws_str) > 0) {
    632         paranoid_free(flaws_str_A);
    633623        mr_asprintf(&flaws_str_A, "%s", flaws_str + 1);
    634624    }
    635625    if (strlen(flaws_str_A) >= 74) {
    636626        for (i = 74; flaws_str_A[i] != ' '; i--);
    637         paranoid_free(flaws_str_B);
    638627        mr_asprintf(&flaws_str_B, "%s", flaws_str_A + i + 1);
    639628        flaws_str_A[i] = '\0';
     
    641630    if (strlen(flaws_str_B) >= 74) {
    642631        for (i = 74; flaws_str_B[i] != ' '; i--);
    643         paranoid_free(flaws_str_C);
    644632        mr_asprintf(&flaws_str_C, "%s", flaws_str_B + i + 1);
    645633        flaws_str_B[i] = '\0';
    646     }
    647     if (res) {
    648         return (FALSE);
    649     } else {
    650         return (TRUE);
    651634    }
    652635}
Note: See TracChangeset for help on using the changeset viewer.