Changeset 3237 in MondoRescue


Ignore:
Timestamp:
Jan 3, 2014, 5:44:13 PM (10 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
Files:
3 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;
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3185 r3237  
    17551755    /** pointers **********************************************************/
    17561756    char *p;
    1757     char *part_table_fmt;
     1757    char *part_table_fmt = NULL;
    17581758    FILE *fout;
    17591759
     
    18441844        }
    18451845    }
     1846    mr_free(part_table_fmt);
     1847
    18461848    mr_strcat(output, "\n");    /*start block (ENTER for next free blk */
    18471849    if (partsize > 0) {
Note: See TracChangeset for help on using the changeset viewer.