Changeset 3237 in MondoRescue for branches/3.2/mondo/src/common


Ignore:
Timestamp:
Jan 3, 2014, 5:44:13 PM (11 years ago)
Author:
Bruno Cornec
Message:

which_partition_format now returns a dynamically allocated string which is then used consistently across the project

Location:
branches/3.2/mondo/src/common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/mondo/src/common/libmondo-devices.c

    r3212 r3237  
    32643264char *which_partition_format(const char *drive)
    32653265{
    3266     static char output[4];
     3266    char *output = NULL;
    32673267    char *tmp = NULL;
    32683268    char *command;
     
    32773277    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    32783278    if (strstr(tmp, "GPT") == NULL) {
    3279         strcpy(output, "MBR");
     3279        mr_asprintf(output, "%s", "MBR");
    32803280    } else {
    3281         strcpy(output, "GPT");
     3281        mr_asprintf(output, "%s", "GPT");
    32823282    }
    32833283    mr_free(tmp);
  • branches/3.2/mondo/src/common/libmondo-mountlist.c

    r3236 r3237  
    6767
    6868    /*@ pointers ******************************************************* */
    69     char *part_table_fmt;
     69    char *part_table_fmt = NULL;
    7070
    7171    /*@ initialize ***************************************************** */
     
    195195            part_table_fmt = which_partition_format(drive);
    196196            /* no spare primary partitions to help accommodate the logical(s)? */
    197             if ((curr_part_no >= 5 && prev_part_no == 4)
    198                 && (strcmp(part_table_fmt, "MBR") == 0)) {
     197            if ((curr_part_no >= 5 && prev_part_no == 4) && (strcmp(part_table_fmt, "MBR") == 0)) {
    199198                mr_asprintf(tmp, " Partition %ss4 is occupied.", drive);
    200199                log_it(tmp);
     
    203202                res++;
    204203            }
     204            mr_free(part_table_fmt);
     205
    205206            /* does partition /dev/adXsY exist more than once in the mountlist? */
    206207            for (i = 0, device_copies = 0;
Note: See TracChangeset for help on using the changeset viewer.