Ignore:
Timestamp:
Apr 27, 2015, 4:25:28 PM (9 years ago)
Author:
Bruno Cornec
Message:

Change the bkpinfo->boot_device from statically allocated to dynamically allocated

File:
1 edited

Legend:

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

    r3371 r3373  
    25952595
    25962596    if (archiving_to_media) {
    2597 
     2597        mr_free(bkpinfo->boot_device);
    25982598#ifdef __FreeBSD__
    2599         strcpy(bkpinfo->boot_device,
    2600                call_program_and_get_last_line_of_output
    2601                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     2599        mr_asprintf(bkpinfo->boot_device, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
    26022600#else
    2603         strcpy(bkpinfo->boot_device,
    2604                call_program_and_get_last_line_of_output
    2605                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     2601        mr_asprintf(bkpinfo->boot_device, "%s", call_program_and_get_last_line_of_output("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
    26062602#endif
    26072603        i = which_boot_loader(bkpinfo->boot_device);
     
    26162612            i = which_boot_loader(bkpinfo->boot_device);
    26172613#else
    2618             if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", bkpinfo->boot_device, MAX_STR_LEN / 4)) {
     2614            strcpy(tmp1, bkpinfo->boot_device);
     2615            if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", tmp1, MAX_STR_LEN / 4)) {
    26192616                log_to_screen("User has chosen not to backup the PC");
    26202617                finish(1);
    26212618            }
    2622             if (does_string_exist_in_boot_block(bkpinfo->boot_device, "LILO")) {
     2619            mr_free(bkpinfo->boot_device);
     2620            mr_asprintf(bkpinfo->boot_device, "%s", tmp1);
     2621
     2622            if (does_string_exist_in_boot_block(bkpinfo->boot_device, "ELILO")) {
     2623                i = 'E';
     2624            } else
     2625                if (does_string_exist_in_boot_block(bkpinfo->boot_device, "LILO")) {
    26232626                i = 'L';
    2624             } else
    2625                 if (does_string_exist_in_boot_block(bkpinfo->boot_device, "ELILO")) {
    2626                 i = 'E';
    26272627            } else
    26282628                if (does_string_exist_in_boot_block(bkpinfo->boot_device, "GRUB")) {
Note: See TracChangeset for help on using the changeset viewer.