Changeset 783 in MondoRescue for trunk/mondo/mondo/common/libmondo-mountlist.c


Ignore:
Timestamp:
Aug 31, 2006, 5:09:20 PM (18 years ago)
Author:
Bruno Cornec
Message:
  • Massive rewrite continues for memory management.
  • main structure should now have all parameters allocated dynamically
  • new lib libmr.a + dir + build process reviewed to support it.
  • new include subdir to host external definitions of the new lib
  • code now compiles. Still one remaining link issues for mondorestore. This should allow for some tests soon.

(goal is to separate completely reviewed code and functions and provide clean interfaces)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/mondo/mondo/common/libmondo-mountlist.c

    r688 r783  
    6363    char *tmp1 = NULL;
    6464    char *device = NULL;
     65    char *ndevice = NULL;
    6566    // BERLIOS : useless ? char *mountpoint;
    6667
     
    203204        npos = 0;
    204205        for (cur_sp_no = 'a'; cur_sp_no <= 'h'; cur_sp_no++) {
    205             sprintf(device, "%ss%i%c", device, curr_part_no, cur_sp_no);
    206             if (find_device_in_mountlist(mountlist, device) >= 0)
     206            asprintf(&ndevice, "%ss%d%c", device, curr_part_no, cur_sp_no);
     207            if (find_device_in_mountlist(mountlist, ndevice) >= 0)
    207208                npos++;
     209            paranoid_free(ndevice);
    208210        }
    209211        paranoid_free(device);
     
    500502
    501503    /*@ buffers ******************************************************** */
    502     char *tmp;
    503     char *device;
     504    char *tmp = NULL;
     505    char *tmp1 = NULL;
     506    char *device = NULL;
    504507
    505508    /*@ long *********************************************************** */
    506     long physical_drive_size = 0;
    507     long amount_allocated = 0;
     509    long physical_drive_size = 0L;
     510    long amount_allocated = 0L;
    508511
    509512    /*@ pointers ******************************************************* */
    510     char *part_table_fmt;
     513    char *part_table_fmt = NULL;
    511514
    512515    /*@ initialize ***************************************************** */
     
    559562            continue;
    560563        }
    561         // BERLIOS : useless ? strcpy(mountpoint, mountlist->el[pos].mountpoint);
     564        // BERLIOS : useless ? str-cpy(mountpoint, mountlist->el[pos].mountpoint);
    562565        /* gap in the partition list? */
    563566        if (curr_part_no - prev_part_no > 1) {
     
    751754    drivelist = malloc(sizeof(struct list_of_disks));
    752755    assert(mountlist != NULL);
    753     assert(flaws_str_A != NULL);
    754     assert(flaws_str_B != NULL);
    755     assert(flaws_str_C != NULL);
    756756
    757757    asprintf(&flaws_str, " ");
Note: See TracChangeset for help on using the changeset viewer.