Ignore:
Timestamp:
May 13, 2009, 4:34:00 AM (15 years ago)
Author:
Bruno Cornec
Message:
  • Remove useless function look_for_weird_formats
  • Adds a test program for mountlist management to find a seg. fault bug when using a large mountlist file
File:
1 edited

Legend:

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

    r2125 r2202  
    508508    /*@ buffer *********************************************************** */
    509509    struct list_of_disks *drivelist;
    510     char *tmp;
    511     char *flaws_str;
     510    char *tmp = NULL;
     511    char *flaws_str = NULL;
    512512
    513513    /*@ int ************************************************************** */
     
    547547    }
    548548    res += look_for_duplicate_mountpoints(mountlist, flaws_str);
    549 /*  res+=look_for_weird_formats(mountlist,flaws_str); .. not necessary, now that we can check to see
    550  which formarts are actually _supported_ by the kernel */
    551     /* log_it(flaws_str); */
    552549    return (spread_flaws_across_three_lines
    553550            (flaws_str, flaws_str_A, flaws_str_B, flaws_str_C, res));
     
    644641    return (res);
    645642}
    646 
    647 /**
    648  * Look for strange formats. Does not respect /proc/filesystems.
    649  * @param mountlist The mountlist to check.
    650  * @param flaws_str The flaws string to append the results to.
    651  * @return The number of weird formats found, or 0 for success.
    652  * @bug Seems orphaned; please remove.
    653  */
    654 int
    655 look_for_weird_formats(struct mountlist_itself *mountlist, char *flaws_str)
    656 {
    657 
    658     /*@ int ************************************************************* */
    659     int i = 0;
    660     int res = 0;
    661 
    662     /*@ buffers ********************************************************* */
    663     char *tmp;
    664     char *format_sz;
    665 
    666     malloc_string(tmp);
    667     malloc_string(format_sz);
    668 
    669     assert(mountlist != NULL);
    670     assert(flaws_str != NULL);
    671 
    672     for (i = 0; i < mountlist->entries; i++) {
    673         sprintf(format_sz, " %s ", mountlist->el[i].format);
    674         if (!strstr(SANE_FORMATS, format_sz)
    675             && strcmp(mountlist->el[i].mountpoint, "image") != 0) {
    676             sprintf(tmp, " %s has unknown format.",
    677                     mountlist->el[i].device);
    678             log_it(tmp);
    679             strcat(flaws_str, tmp);
    680             res++;
    681         } else if ((!strcmp(mountlist->el[i].format, "swap")
    682                     && strcmp(mountlist->el[i].mountpoint, "swap")
    683                     && strcmp(mountlist->el[i].mountpoint, "none"))
    684                    || (strcmp(mountlist->el[i].format, "swap")
    685                        && !strcmp(mountlist->el[i].mountpoint, "swap")
    686                        && !strcmp(mountlist->el[i].mountpoint, "none"))) {
    687             sprintf(tmp, " %s is half-swap.", mountlist->el[i].device);
    688             log_it(tmp);
    689             strcat(flaws_str, tmp);
    690             res++;
    691         }
    692     }
    693     paranoid_free(tmp);
    694     paranoid_free(format_sz);
    695     return (res);
    696 }
    697 
    698643
    699644
Note: See TracChangeset for help on using the changeset viewer.