Ignore:
Timestamp:
May 6, 2015, 1:10:17 PM (5 years ago)
Author:
Bruno Cornec
Message:
  • Rename mr_parted2fdisk to mr-parted2fdisk for consistency with all other new mr-* commands
  • Adds functions mr_center_string and mr_popup_and_get_string with dynamic allocation to solve a memory allocation issue reported on the ML
  • Fix mr_boot_type to detect correctly a UEFI based system
File:
1 edited

Legend:

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

    r3375 r3377  
    327327#else
    328328    return
    329         !system("mr_parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|EFI|FAT|NTFS)'");
     329        !system("mr-parted2fdisk -l 2>/dev/null | grep '^/dev/' | grep -Eqv '(MS|DOS|EFI|FAT|NTFS)'");
    330330#endif
    331331}
     
    364364#endif
    365365
    366     mr_asprintf(program, "mr_parted2fdisk -l %s 2> /dev/null", drive);
     366    mr_asprintf(program, "mr-parted2fdisk -l %s 2> /dev/null", drive);
    367367    fin = popen(program, "r");
    368368    if (!fin) {
     
    17291729    * Either way, it's an error.
    17301730    ********/
    1731     mr_asprintf(command, "mr_parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
     1731    mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null|grep -E \"^/dev/\"|awk '{printf(\"%%s \", $1)}END{print \"\"}'", dsf);
    17321732    log_msg(5, "Executing: %s", command);
    17331733    mr_asprintf(partition_list, "%s", call_program_and_get_last_line_of_output(command));
     
    17951795        log_msg(4, "Processing partition: %s", partitions[i]);
    17961796        /* See if it's swap. If it is, ignore it. */
    1797         mr_asprintf(command, "mr_parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]);
     1797        mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null | awk '{if(($1==\"%s\")&&(toupper($0) ~ \"SWAP\")){print $1;exit}}'", ndsf, partitions[i]);
    17981798        log_msg(5, "  Running: %s", command);
    17991799        mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
     
    21102110
    21112111    t_boot ret = BIOS;
    2112     FILE *fd = NULL;
     2112    DIR *fd = NULL;
    21132113
    21142114#ifdef __IA64__
     
    21162116#endif
    21172117    /* Try to detect whether we are in fact in UEFI mode */
    2118     /* TODO: find the right trigger */
    2119     fd = fopen("/sys/module/efi", "r");
     2118    fd = opendir("/sys/firmware/efi", "r");
    21202119    if (fd != NULL) {
    21212120        ret = UEFI;
     2121        closedir(fd);
    21222122    }
    21232123    return(ret);
     
    23652365        mr_free(tmp);
    23662366
    2367         if (!popup_and_get_string("Tape block size?", "What is the block size of your tape streamer?", sz_size, 15)) {
     2367        mr_asprintf(sz_size,"%s",bkpinfo->internal_tape_block_size);
     2368        tmp = mr_popup_and_get_string("Tape block size?", "What is the block size of your tape streamer?", sz_size);
     2369        if (tmp == NULL) {
    23682370            log_to_screen("User has chosen not to backup the PC");
    23692371            finish(1);
    23702372        }
    2371         bkpinfo->internal_tape_block_size = atol(sz_size);
     2373        bkpinfo->internal_tape_block_size = atol(tmp);
     2374        mr_free(sz_size);
     2375        mr_free(tmp);
     2376
    23722377        if (bkpinfo->internal_tape_block_size <= 0) {
    23732378            log_to_screen("User has chosen not to backup the PC");
     
    26822687        mr_free(tmp);
    26832688// NTFS
    2684         strcpy(tmp1, call_program_and_get_last_line_of_output("mr_parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
     2689        strcpy(tmp1, call_program_and_get_last_line_of_output("mr-parted2fdisk -l 2>/dev/null | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    26852690        if (strlen(tmp1) > 2) {
    26862691            if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) {
     
    31003105    assert(which_device != NULL);
    31013106
    3102     mr_asprintf(list_drives_cmd, "mr_parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
     3107    mr_asprintf(list_drives_cmd, "mr-parted2fdisk -l 2>/dev/null | grep \"/dev/.*:\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/; echo %s", where_is_root_mounted());
    31033108    log_it("list_drives_cmd = %s", list_drives_cmd);
    31043109
     
    31423147    } else {
    31433148        // We need to look on each partition then
    3144         mr_asprintf(list_drives_cmd, "mr_parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
     3149        mr_asprintf(list_drives_cmd, "mr-parted2fdisk -l 2>/dev/null | grep -E \"^/dev/\" | tr -s ':' ' ' | tr -s ' ' '\n' | grep /dev/");
    31453150        log_it("list_drives_cmd = %s", list_drives_cmd);
    31463151
     
    32903295    struct stat buf;
    32913296#endif
    3292     mr_asprintf(command, "mr_parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);
     3297    mr_asprintf(command, "mr-parted2fdisk -l %s 2>/dev/null | grep 'EFI GPT'", drive);
    32933298    mr_asprintf(tmp, "%s", call_program_and_get_last_line_of_output(command));
    32943299    mr_free(command);
Note: See TracChangeset for help on using the changeset viewer.