Changeset 3263 in MondoRescue for branches


Ignore:
Timestamp:
Apr 22, 2014, 11:06:38 AM (10 years ago)
Author:
Bruno Cornec
Message:
  • Fix a bug due to lack of memory allocation for a tmp var to display
  • Fix another bug in the call to labeling which used a bad variable
Location:
branches/3.2/mondo/src
Files:
5 edited

Legend:

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

    r3237 r3263  
    32833283    mr_free(tmp);
    32843284
    3285     log_msg(0, "Found %s partition table format type", output);
     3285    log_msg(0, "Found %s partition table format type on %s", output, drive);
    32863286    paranoid_free(command);
    32873287    paranoid_free(fdisk);
  • branches/3.2/mondo/src/common/libmondo-mountlist.c

    r3237 r3263  
    413413    }
    414414
     415    /* GPT allows more than 4 primary partitions - detect partition type now */
     416    part_table_fmt = which_partition_format(drive);
     417
    415418    for (curr_part_no = 1; curr_part_no < 99; curr_part_no++) {
    416419        build_partition_name(device, drive, curr_part_no);
     
    428431                mr_free(tmp);
    429432                res++;
    430             } else if (curr_part_no > 5
    431                        || (curr_part_no <= 4 && prev_part_no > 0)) {
     433            } else if (curr_part_no > 5 || (curr_part_no <= 4 && prev_part_no > 0)) {
    432434                mr_asprintf(tmp, " Gap on %s between %d and %d.", drive, prev_part_no, curr_part_no);
    433435                log_it(tmp);
     
    437439            }
    438440        }
    439         /* GPT allows more than 4 primary partitions */
    440         part_table_fmt = which_partition_format(drive);
    441441        /* no spare primary partitions to help accommodate the logical(s)? */
    442442        if ((curr_part_no >= 5 && prev_part_no == 4) && (strcmp(part_table_fmt, "MBR") == 0)) {
     
    447447            res++;
    448448        }
    449         mr_free(part_table_fmt);
    450449
    451450        /* does partition /dev/hdNX exist more than once in the mountlist? */
     
    498497        prev_part_no = curr_part_no;
    499498    }
     499    mr_free(part_table_fmt);
    500500
    501501    /* Over-allocated the disk? Unallocated space on disk? */
     
    589589            }
    590590        }
    591         if (copies > 1 && last_copy == currline
    592             && strcmp(curr_mountpoint, "raid")) {
     591        if (copies > 1 && last_copy == currline && strcmp(curr_mountpoint, "raid")) {
    593592            mr_asprintf(tmp, " %s %s's.", number_to_text(copies), curr_mountpoint);
    594593            mr_strcat(flaws_str, "%s", tmp);
  • branches/3.2/mondo/src/mondorestore/mondo-prep.c

    r3237 r3263  
    26162616
    26172617    if (g_mountlist_fname[0] == '\0') {
    2618         log_it
    2619             ("resize_mountlist_prop...() - warning - mountlist fname is blank");
     2618        log_it("resize_mountlist_prop...() - warning - mountlist fname is blank");
    26202619        log_it("That does NOT affect the functioning of this subroutine.");
    26212620        log_it("--- Hugo, 2002/11/20");
     
    26252624    log_it("Back from MLoDiM");
    26262625    for (driveno = 0; driveno < drivelist->entries; driveno++) {
    2627         resize_drive_proportionately_to_suit_new_drives(mountlist,
    2628                                                         drivelist->
    2629                                                         el[driveno].
    2630                                                         device);
     2626        resize_drive_proportionately_to_suit_new_drives(mountlist, drivelist->el[driveno].device);
    26312627    }
    26322628    log_to_screen("Mountlist adjusted to suit current hard drive(s)");
  • branches/3.2/mondo/src/mondorestore/mondo-rstr-tools.c

    r3211 r3263  
    185185{
    186186while (get_cfg_file_from_archive()) {
    187 if (!ask_me_yes_or_no
    188     ("Failed to find config file/archives. Choose another source?"))
    189 {
    190     fatal_error("Could not find config file/archives. Aborting.");
    191 }
    192 interactively_obtain_media_parameters_from_user(FALSE);
    193 }
     187    if (!ask_me_yes_or_no("Failed to find config file/archives. Choose another source?")) {
     188        fatal_error("Could not find config file/archives. Aborting.");
     189    }
     190    interactively_obtain_media_parameters_from_user(FALSE);
     191    }
    194192}
    195193
     
    21182116            log_msg(2, "gcffa --- calling mount_media now :)");
    21192117            if (!mount_media()) {
    2120                 log_msg(2,
    2121                         "gcffa --- managed to mount CD; so, no need for Plan B");
     2118                log_msg(2, "gcffa --- managed to mount CD; so, no need for Plan B");
    21222119                try_plan_B = FALSE;
    21232120            } else {
     
    21762173                }
    21772174
    2178                 log_msg(2,
    2179                         "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz");
     2175                log_msg(2, "gcffa --- Plan B, a.k.a. untarring some file from all.tar.gz");
    21802176                mr_asprintf(command, "tar -zxvf " MNT_CDROM "/images/all.tar.gz ./%s ./%s ./%s ./%s ./%s", MOUNTLIST_FNAME_STUB, MONDO_CFG_FILE_STUB, BIGGIELIST_TXT_STUB, FILELIST_FULL_STUB, IWANTMYLVM_STUB);    // add -b TAPE_BLOCK_SIZE if you _really_ think it's necessary
    21812177                run_program_and_log_output(command, TRUE);
     
    22002196        mr_asprintf(command, "cp -f %s %s", tmp, cfg_file);
    22012197        log_it("%s",command);
    2202         if (strcmp(tmp, cfg_file)
    2203             && run_program_and_log_output(command, 1)) {
     2198        if (strcmp(tmp, cfg_file) && run_program_and_log_output(command, 1)) {
    22042199            log_msg(1,
    22052200                    "... but an error occurred when I tried to move it to %s",
     
    22132208        log_it("%s",command);
    22142209        if (extract_mountlist_stub) {
    2215             if (strcmp(tmp, cfg_file)
    2216                 && run_program_and_log_output(command, 1)) {
     2210            if (strcmp(tmp, cfg_file) && run_program_and_log_output(command, 1)) {
    22172211                log_msg(1, "Failed to get mountlist");
    22182212            } else {
     
    22382232        log_it("%s",cfg_file);
    22392233        log_msg(1, "%s not found", cfg_file);
    2240         log_to_screen
    2241             ("Oh dear. Unable to recover configuration file from boot disk");
     2234        log_to_screen("Oh dear. Unable to recover configuration file from boot disk");
    22422235        return (1);
    22432236    }
     
    22462239    if (!does_file_exist(MOUNTLIST_FNAME_STUB)) {
    22472240        log_to_screen("...but not mountlist.txt - a pity, really...");
    2248     }
    2249     else {
     2241    } else {
    22502242            /* Is this code really useful ??? */
    22512243        if (extract_mountlist_stub) {
  • branches/3.2/mondo/src/mondorestore/mondorestore.c

    r3194 r3263  
    760760    flaws_str = evaluate_mountlist(mountlist);
    761761    if (flaws_str != NULL) {
    762         sprintf(tmp,
    763                 "Mountlist analyzed. Result: \"%s\" Switch to Interactive Mode?",
    764                 flaws_str);
     762        mr_asprintf(tmp, "Mountlist analyzed. Result: \"%s\" Switch to Interactive Mode?", flaws_str);
    765763        mr_free(flaws_str);
    766764        if (ask_me_yes_or_no(tmp)) {
    767765            retval = interactive_mode(mountlist, raidlist);
     766            mr_free(tmp);
    768767            goto after_the_nuke;
    769768        } else {
     
    846845
    847846    mr_asprintf(tmp1, "label-partitions-as-necessary %s < /tmp/fstab >> %s 2>> %s", MINDI_CACHE"/mountlist.txt", MONDO_LOGFILE, MONDO_LOGFILE);
    848     res = run_program_and_log_output(tmp, TRUE);
     847    res = run_program_and_log_output(tmp1, TRUE);
    849848    mr_free(tmp1);
    850849    if (res) {
Note: See TracChangeset for help on using the changeset viewer.