Changeset 3777 in MondoRescue for branches/3.3/mondo/src/common/libmondo-devices.c
- Timestamp:
- Nov 19, 2020, 2:17:57 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mondo/src/common/libmondo-devices.c
r3755 r3777 492 492 493 493 if (!dev[0] || (res = mount_CDROM_here(dev, mountpoint))) { 494 if (!popup_and_get_string("CD-ROM device", "Please enter your CD-ROM's /dev device", dev, MAX_STR_LEN / 4)) {494 if (!popup_and_get_string("CD-ROM device", "Please enter your CD-ROM's /dev device", dev,(MAX_STR_LEN / 4)-1)) { 495 495 res = 1; 496 496 } else { … … 2308 2308 log_msg(1, "bkpinfo->media_device = %s", bkpinfo->media_device); 2309 2309 mr_asprintf(comment, "Please specify your %s drive's /dev entry", mds); 2310 if (!popup_and_get_string("Device?", comment, bkpinfo->media_device, MAX_STR_LEN / 4)) {2310 if (!popup_and_get_string("Device?", comment, bkpinfo->media_device,(MAX_STR_LEN / 4)-1)) { 2311 2311 log_to_screen("User has chosen not to backup the machine"); 2312 2312 finish(1); … … 2331 2331 if (!bkpinfo->media_device[0]) { 2332 2332 if (bkpinfo->backup_media_type == usb) { 2333 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);2333 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)-1); 2334 2334 } else { 2335 2335 if (g_kernel_version < 2.6) { 2336 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);2336 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)-1); 2337 2337 } else { 2338 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);2338 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)-1); 2339 2339 } 2340 2340 } … … 2385 2385 } 2386 2386 if (!bkpinfo->media_device[0]) { 2387 if (!popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device, MAX_STR_LEN / 4)) {2387 if (!popup_and_get_string("Device name?", "What is the /dev entry of your tape streamer?", bkpinfo->media_device,(MAX_STR_LEN / 4)-1)) { 2388 2388 log_to_screen("User has chosen not to backup the machine"); 2389 2389 finish(1); … … 2457 2457 #endif 2458 2458 { 2459 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)) {2459 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)-1)) { 2460 2460 log_to_screen("User has chosen not to backup the machine"); 2461 2461 finish(1); … … 2523 2523 } 2524 2524 strcpy(tmp1, bkpinfo->netfs_proto); 2525 if (!popup_and_get_string("Network protocol", "Which protocol should I use (nfs/sshfs/smbfs) ?",tmp1, MAX_STR_LEN )) {2525 if (!popup_and_get_string("Network protocol", "Which protocol should I use (nfs/sshfs/smbfs) ?",tmp1, MAX_STR_LEN-1)) { 2526 2526 log_to_screen("User has chosen not to backup the machine"); 2527 2527 finish(1); … … 2531 2531 2532 2532 strcpy(tmp1, bkpinfo->netfs_mount); 2533 if (!popup_and_get_string("Network share", "Which remote share should I mount?", tmp1, MAX_STR_LEN )) {2533 if (!popup_and_get_string("Network share", "Which remote share should I mount?", tmp1, MAX_STR_LEN-1)) { 2534 2534 log_to_screen("User has chosen not to backup the machine"); 2535 2535 finish(1); … … 2543 2543 strcpy(tmp1, ""); 2544 2544 } 2545 if (!popup_and_get_string("Network user", "Which user should I use if any ?",tmp1, MAX_STR_LEN )) {2545 if (!popup_and_get_string("Network user", "Which user should I use if any ?",tmp1, MAX_STR_LEN-1)) { 2546 2546 log_to_screen("User has chosen not to backup the machine"); 2547 2547 finish(1); … … 2560 2560 } else { 2561 2561 // Why netfsdir ? 2562 s printf(bkpinfo->isodir, "%s/netfsdir", bkpinfo->tmpdir);2562 snprintf(bkpinfo->isodir, (MAX_STR_LEN / 4) -1, "%s/netfsdir", bkpinfo->tmpdir); 2563 2563 mr_asprintf(command, "mkdir -p %s", bkpinfo->isodir); 2564 2564 run_program_and_log_output(command, 5); … … 2606 2606 } 2607 2607 strcpy(tmp1, bkpinfo->netfs_remote_dir); 2608 if (!popup_and_get_string ("Directory", "Which directory within that mountpoint?", tmp1, MAX_STR_LEN )) {2608 if (!popup_and_get_string ("Directory", "Which directory within that mountpoint?", tmp1, MAX_STR_LEN-1)) { 2609 2609 log_to_screen("User has chosen not to backup the machine"); 2610 2610 finish(1); … … 2614 2614 bkpinfo->netfs_remote_dir = mr_strip_spaces(tmp1); 2615 2615 2616 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)) {2616 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)-1)) { 2617 2617 log_to_screen("User has chosen not to backup the machine"); 2618 2618 finish(1); … … 2625 2625 case iso: 2626 2626 if (!bkpinfo->disaster_recovery) { 2627 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)) {2627 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)-1)) { 2628 2628 log_to_screen("User has chosen not to backup the machine"); 2629 2629 finish(1); … … 2648 2648 } 2649 2649 } 2650 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)) {2650 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)-1)) { 2651 2651 log_to_screen("User has chosen not to backup the machine"); 2652 2652 finish(1); … … 2672 2672 2673 2673 #ifdef __FreeBSD__ 2674 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device, MAX_STR_LEN / 4)) {2674 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/ad0)", bkpinfo->boot_device,(MAX_STR_LEN / 4)-1)) { 2675 2675 log_to_screen("User has chosen not to backup the machine"); 2676 2676 finish(1); … … 2679 2679 #else 2680 2680 strcpy(tmp1, bkpinfo->boot_device); 2681 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", tmp1, MAX_STR_LEN / 4)) {2681 if (!popup_and_get_string("Boot device", "What is your boot device? (e.g. /dev/hda)", tmp1,(MAX_STR_LEN / 4)-1)) { 2682 2682 log_to_screen("User has chosen not to backup the machine"); 2683 2683 finish(1); … … 2716 2716 strcpy(tmp1, "/"); 2717 2717 } 2718 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 )) {2718 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-1)) { 2719 2719 log_to_screen("User has chosen not to backup the machine"); 2720 2720 finish(1); … … 2729 2729 // NTFS 2730 2730 tmp = 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};'"); 2731 strncpy(tmp1, tmp, MAX_STR_LEN / 4);2731 strncpy(tmp1, tmp,(MAX_STR_LEN / 4)-1); 2732 2732 mr_free(tmp); 2733 2733 if (strlen(tmp1) > 2) { 2734 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1, MAX_STR_LEN / 4)) {2734 if (!popup_and_get_string("NTFS partitions", "Please enter/confirm the NTFS partitions you wish to backup as well.", tmp1,(MAX_STR_LEN / 4)-1)) { 2735 2735 log_to_screen("User has chosen not to backup the machine"); 2736 2736 finish(1); 2737 2737 } 2738 strncpy(bkpinfo->image_devs, tmp1, MAX_STR_LEN / 4);2738 strncpy(bkpinfo->image_devs, tmp1, (MAX_STR_LEN / 4)-1); 2739 2739 } 2740 2740 … … 2755 2755 mr_asprintf(oldtmp, "%s", bkpinfo->tmpdir); 2756 2756 if (bkpinfo->tmpdir != NULL ) { 2757 strncpy(p,bkpinfo->tmpdir,( 16*MAX_STR_LEN)-1);2757 strncpy(p,bkpinfo->tmpdir,(MAX_STR_LEN / 4)-1); 2758 2758 } else { 2759 2759 p[0] = '\0'; … … 2771 2771 mr_asprintf(oldtmp, "%s", bkpinfo->scratchdir); 2772 2772 if (bkpinfo->scratchdir != NULL ) { 2773 strncpy(p,bkpinfo->scratchdir,( 16*MAX_STR_LEN)-1);2773 strncpy(p,bkpinfo->scratchdir,(MAX_STR_LEN / 4)-1); 2774 2774 } else { 2775 2775 p[0] = '\0';
Note:
See TracChangeset
for help on using the changeset viewer.