Ignore:
Timestamp:
Aug 18, 2009, 3:19:54 PM (15 years ago)
Author:
Bruno Cornec
Message:

r3337@localhost: bruno | 2009-08-11 20:02:18 +0200
bkpinfo->boot_device and bkpinfo->zip_exe are now dynamically allocated

File:
1 edited

Legend:

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

    r2325 r2326  
    18231823    if (archiving_to_media) {
    18241824
     1825        mr_free(bkpinfo->boot_device);
    18251826#ifdef __FreeBSD__
    1826         strcpy(bkpinfo->boot_device,
    1827                call_program_and_get_last_line_of_output
    1828                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/\\([0-9]\\).*/\\1/'"));
     1827#define EXAMPLEBD   "/dev/ad0"
     1828        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/'"));
    18291829#else
    1830         strcpy(bkpinfo->boot_device,
    1831                call_program_and_get_last_line_of_output
    1832                ("mount | grep ' / ' | head -1 | cut -d' ' -f1 | sed 's/[0-9].*//'"));
     1830#define EXAMPLEBD   "/dev/hda"
     1831        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].*//'"));
    18331832#endif
    18341833        i = which_boot_loader(bkpinfo->boot_device);
     
    18361835        {
    18371836
    1838 #ifdef __FreeBSD__
    1839             p = popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device);
    1840             if (!p == NULL) {
    1841                 log_to_screen("User has chosen not to backup the PC");
    1842                 finish(1);
    1843             }
    1844             strcpy(bkpinfo->boot_device, p);
    1845             mr_free(p);
    1846             i = which_boot_loader(bkpinfo->boot_device);
    1847 #else
    1848             p = popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", bkpinfo->boot_device);
     1837            p = popup_and_get_string("Boot device", "What is your boot device? (e.g. "EXAMPLEBD")", bkpinfo->boot_device);
     1838#undef EXAMPLEBD
    18491839            if (p == NULL) {
    18501840                log_to_screen("User has chosen not to backup the PC");
    18511841                finish(1);
    18521842            }
    1853             strcpy(bkpinfo->boot_device, p);
    1854             mr_free(p);
    1855 
     1843            mr_free(bkpinfo->boot_device);
     1844            bkpinfo->boot_device = p;
     1845#ifdef __FreeBSD__
     1846            i = which_boot_loader(bkpinfo->boot_device);
     1847#else
    18561848            if (does_string_exist_in_boot_block(bkpinfo->boot_device, "LILO")) {
    18571849                i = 'L';
     
    18671859#endif
    18681860            if (i == 'U') {
    1869                 if (ask_me_yes_or_no
    1870                     ("Unidentified boot loader. Shall I restore it byte-for-byte at restore time and hope for the best?"))
    1871                 {
     1861                if (ask_me_yes_or_no("Unidentified boot loader. Shall I restore it byte-for-byte at restore time and hope for the best?")) {
    18721862                    i = 'R';    // raw
    18731863                } else {
    1874                     log_to_screen
    1875                         ("I cannot find your boot loader. Please run mondoarchive with parameters.");
     1864                    log_to_screen("I cannot find your boot loader. Please run mondoarchive with parameters.");
    18761865                    finish(1);
    18771866                }
Note: See TracChangeset for help on using the changeset viewer.