Changeset 3212


Ignore:
Timestamp:
Dec 21, 2013, 7:41:34 PM (6 years ago)
Author:
bruno
Message:
  • Fix wrong analyzis of temp and scratch dirs in interactive mode (wrong memory allocation mngt and comparison with previous dir) (report from Rick Stevens)
File:
1 edited

Legend:

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

    r3207 r3212  
    489489
    490490    if (!dev[0] || (res = mount_CDROM_here(dev, mountpoint))) {
    491         if (!popup_and_get_string
    492             ("CD-ROM device", "Please enter your CD-ROM's /dev device",
    493              dev, MAX_STR_LEN / 4)) {
     491        if (!popup_and_get_string("CD-ROM device", "Please enter your CD-ROM's /dev device", dev, MAX_STR_LEN / 4)) {
    494492            res = 1;
    495493        } else {
     
    21332131    char *tmp1 = NULL;
    21342132    char *mds = NULL;
     2133    char *oldtmp = NULL;
    21352134    char *q = NULL;
    21362135    char p[16*MAX_STR_LEN];
     
    22872286            if (!bkpinfo->media_device[0]) {
    22882287                if (bkpinfo->backup_media_type == usb) {
    2289                     i = popup_and_get_string("/dev entry?",
    2290                                          "What is the /dev entry of your USB Disk/Key, please?",
    2291                                          bkpinfo->media_device,
    2292                                          MAX_STR_LEN / 4);
     2288                    i = popup_and_get_string("/dev entry?", "What is the /dev entry of your USB Disk/Key, please?", bkpinfo->media_device, MAX_STR_LEN / 4);
    22932289                } else {
    22942290                    if (g_kernel_version < 2.6) {
    2295                         i = popup_and_get_string("Device node?",
    2296                                              "What is the SCSI node of your CD (re)writer, please?",
    2297                                              bkpinfo->media_device,
    2298                                              MAX_STR_LEN / 4);
     2291                        i = popup_and_get_string("Device node?", "What is the SCSI node of your CD (re)writer, please?", bkpinfo->media_device, MAX_STR_LEN / 4);
    22992292                    } else {
    2300                         i = popup_and_get_string("/dev entry?",
    2301                                              "What is the /dev entry of your CD (re)writer, please?",
    2302                                              bkpinfo->media_device,
    2303                                              MAX_STR_LEN / 4);
     2293                        i = popup_and_get_string("/dev entry?", "What is the /dev entry of your CD (re)writer, please?", bkpinfo->media_device, MAX_STR_LEN / 4);
    23042294                    }
    23052295                }
     
    23502340        }
    23512341        if (!bkpinfo->media_device[0]) {
    2352             if (!popup_and_get_string
    2353                 ("Device name?",
    2354                  "What is the /dev entry of your tape streamer?",
    2355                  bkpinfo->media_device, MAX_STR_LEN / 4)) {
     2342            if (!popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device, MAX_STR_LEN / 4)) {
    23562343                log_to_screen("User has chosen not to backup the PC");
    23572344                finish(1);
     
    23652352        mr_free(tmp);
    23662353
    2367         if (!popup_and_get_string
    2368             ("Tape block size?",
    2369              "What is the block size of your tape streamer?",
    2370              sz_size, 15)) {
     2354        if (!popup_and_get_string("Tape block size?", "What is the block size of your tape streamer?", sz_size, 15)) {
    23712355            log_to_screen("User has chosen not to backup the PC");
    23722356            finish(1);
     
    24202404#endif
    24212405        {
    2422             if (!popup_and_get_string
    2423                 ("Network shared dir.",
    2424                  "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)",
    2425                  p, MAX_STR_LEN / 4)) {
     2406            if (!popup_and_get_string("Network shared dir.", "Please enter path and directory where archives are stored remotely. (Mondo has taken a guess at the correct value. If it is incorrect, delete it and type the correct one.)", p, MAX_STR_LEN / 4)) {
    24262407                log_to_screen("User has chosen not to backup the PC");
    24272408                finish(1);
     
    25642545        }
    25652546        strcpy(tmp1, bkpinfo->netfs_remote_dir);
    2566         if (!popup_and_get_string
    2567             ("Directory", "Which directory within that mountpoint?", tmp1,
    2568              MAX_STR_LEN)) {
     2547        if (!popup_and_get_string ("Directory", "Which directory within that mountpoint?", tmp1, MAX_STR_LEN)) {
    25692548            log_to_screen("User has chosen not to backup the PC");
    25702549            finish(1);
     
    25762555        mr_strip_spaces(bkpinfo->netfs_remote_dir);
    25772556
    2578         if (!popup_and_get_string
    2579             ("Prefix.",
    2580              "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files",
    2581             bkpinfo->prefix, MAX_STR_LEN / 4)) {
     2557        if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix, MAX_STR_LEN / 4)) {
    25822558            log_to_screen("User has chosen not to backup the PC");
    25832559            finish(1);
     
    25902566    case iso:
    25912567        if (!bkpinfo->disaster_recovery) {
    2592             if (!popup_and_get_string
    2593                 ("Storage dir.",
    2594                  "Please enter the full path name to the directory for your ISO images.  Example: /mnt/raid0_0",
    2595                  bkpinfo->isodir, MAX_STR_LEN / 4)) {
     2568            if (!popup_and_get_string("Storage dir.", "Please enter the full path name to the directory for your ISO images.  Example: /mnt/raid0_0", bkpinfo->isodir, MAX_STR_LEN / 4)) {
    25962569                log_to_screen("User has chosen not to backup the PC");
    25972570                finish(1);
     
    26072580                }
    26082581                sprintf(tmp1, "%d", DEFAULT_DVD_DISK_SIZE); // 4.7 salesman's GB = 4.482 real GB = 4482 MB
    2609                 if (!popup_and_get_string
    2610                     ("ISO size.",
    2611                      "Please enter how big you want each ISO image to be (in megabytes). This should be less than or equal to the size of the CD-R[W]'s (700) or DVD's (4480) you plan to backup to.",
    2612                      tmp1, 16)) {
     2582                if (!popup_and_get_string("ISO size.", "Please enter how big you want each ISO image to be (in megabytes). This should be less than or equal to the size of the CD-R[W]'s (700) or DVD's (4480) you plan to backup to.", tmp1, 16)) {
    26132583                    log_to_screen("User has chosen not to backup the PC");
    26142584                    finish(1);
     
    26192589            }
    26202590        }
    2621         if (!popup_and_get_string
    2622             ("Prefix.",
    2623              "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files",
    2624              bkpinfo->prefix, MAX_STR_LEN / 4)) {
     2591        if (!popup_and_get_string("Prefix.", "Please enter the prefix that will be prepended to your ISO filename.  Example: machine1 to obtain machine1-[1-9]*.iso files", bkpinfo->prefix, MAX_STR_LEN / 4)) {
    26252592            log_to_screen("User has chosen not to backup the PC");
    26262593            finish(1);
     
    26482615
    26492616#ifdef __FreeBSD__
    2650             if (!popup_and_get_string
    2651                 ("Boot device",
    2652                  "What is your boot device? (e.g. /dev/ad0)",
    2653                  bkpinfo->boot_device, MAX_STR_LEN / 4)) {
     2617            if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device, MAX_STR_LEN / 4)) {
    26542618                log_to_screen("User has chosen not to backup the PC");
    26552619                finish(1);
     
    26572621            i = which_boot_loader(bkpinfo->boot_device);
    26582622#else
    2659             if (!popup_and_get_string
    2660                 ("Boot device",
    2661                  "What is your boot device? (e.g. /dev/hda)",
    2662                  bkpinfo->boot_device, MAX_STR_LEN / 4)) {
     2623            if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", bkpinfo->boot_device, MAX_STR_LEN / 4)) {
    26632624                log_to_screen("User has chosen not to backup the PC");
    26642625                finish(1);
     
    26932654            strcpy(tmp1, "/");
    26942655        }
    2695         if (!popup_and_get_string
    2696             ("Backup paths",
    2697              "Please enter paths (separated by '|') which you want me to backup. The default is '/' (i.e. everything).",
    2698              tmp1, MAX_STR_LEN)) {
     2656        if (!popup_and_get_string("Backup paths", "Please enter paths (separated by '|') which you want me to backup. The default is '/' (i.e. everything).", tmp1, MAX_STR_LEN)) {
    26992657            log_to_screen("User has chosen not to backup the PC");
    27002658            finish(1);
     
    27102668        strcpy(tmp1, call_program_and_get_last_line_of_output("parted2fdisk -l | grep -i ntfs | awk '{ print $1};' | tr -s '\\n' ' ' | awk '{ print $0};'"));
    27112669        if (strlen(tmp1) > 2) {
    2712             if (!popup_and_get_string
    2713                 ("NTFS partitions",
    2714                  "Please enter/confirm the NTFS partitions you wish to backup as well.",
    2715                  tmp1, MAX_STR_LEN / 4)) {
     2670            if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) {
    27162671                log_to_screen("User has chosen not to backup the PC");
    27172672                finish(1);
     
    27342689        bkpinfo->exclude_paths = tmp;
    27352690
    2736         if (!popup_and_get_string
    2737             ("Temporary directory",
    2738              "Please enter your temporary directory.",
    2739              bkpinfo->tmpdir, (4*MAX_STR_LEN)-1)) {
     2691        mr_asprintf(oldtmp, "%s", bkpinfo->tmpdir);
     2692        if (bkpinfo->tmpdir != NULL ) {
     2693            strncpy(p,bkpinfo->tmpdir,(16*MAX_STR_LEN)-1);
     2694        } else {
     2695            p[0] = '\0';
     2696        }
     2697        if (!popup_and_get_string("Temporary directory", "Please enter your temporary directory.", p, (4*MAX_STR_LEN)-1)) {
    27402698            log_to_screen("User has chosen not to backup the PC");
    27412699            finish(1);
    27422700        }
    27432701        /*  if modified to another path */
    2744         if (strstr(bkpinfo->tmpdir,"mondo.tmp.") == NULL) {
    2745             setup_tmpdir(bkpinfo->tmpdir);
    2746         }
    2747         if (!popup_and_get_string
    2748             ("Scratch directory",
    2749              "Please enter your scratch directory.",
    2750              bkpinfo->scratchdir, (4*MAX_STR_LEN)-1)) {
     2702        if (strcmp(p,oldtmp) != 0) {
     2703            setup_tmpdir(p);
     2704        }
     2705        mr_free(oldtmp);
     2706
     2707        mr_asprintf(oldtmp, "%s", bkpinfo->scratchdir);
     2708        if (bkpinfo->scratchdir != NULL ) {
     2709            strncpy(p,bkpinfo->scratchdir,(16*MAX_STR_LEN)-1);
     2710        } else {
     2711            p[0] = '\0';
     2712        }
     2713        if (!popup_and_get_string("Scratch directory", "Please enter your scratch directory.", p, (4*MAX_STR_LEN)-1)) {
    27512714            log_to_screen("User has chosen not to backup the PC");
    27522715            finish(1);
    27532716        }
    27542717        /*  if modified to another path */
    2755         if (strstr(bkpinfo->scratchdir,"mondo.scratch.") == NULL) {
    2756             setup_scratchdir(bkpinfo->scratchdir);
    2757         }
     2718        if (strcmp(p,oldtmp) != 0) {
     2719            setup_scratchdir(p);
     2720        }
     2721        mr_free(oldtmp);
     2722
    27582723        if (ask_me_yes_or_no("Do you want to backup extended attributes?")) {
    27592724            if (find_home_of_exe("getfattr")) {
Note: See TracChangeset for help on using the changeset viewer.